-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68ee4da
commit 3d94e42
Showing
25 changed files
with
1,194 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// src/api/hosting.ts | ||
|
||
interface HostingData { | ||
type: string; | ||
address: { | ||
sido: string; | ||
sigungu: string; | ||
street: string; | ||
detail: string; | ||
}; | ||
// images: ImageFile[]; | ||
name: string; | ||
description: string; | ||
price: string; | ||
maxOccupancy: string; | ||
} | ||
|
||
// interface ImageFile { | ||
// file: File; | ||
// preview: string; | ||
// isCover: boolean; | ||
// } | ||
|
||
interface HostingResponse { | ||
id: string; | ||
// 다른 응답 필드들도 필요하다면 여기에 추가 | ||
} | ||
|
||
export const createHosting = async ( | ||
hostingData: HostingData, | ||
): Promise<HostingResponse> => { | ||
// const BASE_URL = 'https://d2gjarpl85ijp5.cloudfront.net'; | ||
|
||
// const token = localStorage.getItem('token'); | ||
|
||
// if (token == null) { | ||
// throw new Error('인증 토큰이 없습니다.'); | ||
// } | ||
|
||
const token = | ||
'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJzdHJpbmciLCJpYXQiOjE3MzY0MDk2MzIsImV4cCI6MTczNjQ5NjAzMn0.CsjQZXSWlwA4K2Zyi2aoJAnjCshd25RicVcefWlv3fz0oQefXcKtx5UwiEpKiJMBMkwz3L_2qLHAcPdDVC_rxw'; | ||
|
||
const response = await fetch(`/api/v1/rooms`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
body: JSON.stringify({ | ||
// API 명세에 맞게 데이터 구조화 | ||
type: hostingData.type, | ||
address: hostingData.address, | ||
name: hostingData.name, | ||
description: hostingData.description, | ||
price: Number(hostingData.price), // 문자열을 숫자로 변환 | ||
maxOccupancy: Number(hostingData.maxOccupancy), // 문자열을 숫자로 변환 | ||
}), | ||
}); | ||
|
||
if (!response.ok) { | ||
throw new Error('숙소 등록에 실패했습니다.'); | ||
} | ||
|
||
const responseData = (await response.json()) as HostingResponse; | ||
|
||
return responseData; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// constants/accommodationTypes.ts | ||
type AccommodationType = { | ||
label: string; | ||
imageUrl: string; | ||
}; | ||
|
||
export const ACCOMMODATION_TYPES: AccommodationType[] = [ | ||
{ | ||
label: '아파트', | ||
imageUrl: | ||
'https://a0.muscache.com/pictures/4d7580e1-4ab2-4d26-a3d6-97f9555ba8f9.jpg', | ||
}, | ||
{ | ||
label: '주택', | ||
imageUrl: | ||
'https://a0.muscache.com/pictures/732edad8-3ae0-49a8-a451-29a8010dcc0c.jpg', | ||
}, | ||
{ | ||
label: '별장', | ||
imageUrl: | ||
'https://a0.muscache.com/pictures/3b1eb541-46d9-4bef-abc4-c37d77e3c21b.jpg', | ||
}, | ||
{ | ||
label: '한옥', | ||
imageUrl: | ||
'https://a0.muscache.com/pictures/51f5cf64-5821-400c-8033-8a10c7787d69.jpg', | ||
}, | ||
{ | ||
label: '수영장', | ||
imageUrl: | ||
'https://a0.muscache.com/pictures/3fb523a0-b622-4368-8142-b5e03df7549b.jpg', | ||
}, | ||
{ | ||
label: '호텔', | ||
imageUrl: | ||
'https://a0.muscache.com/pictures/64b27fed-56a1-4f03-950a-d8da08efb428.jpg', | ||
}, | ||
{ | ||
label: '캠핑장', | ||
imageUrl: | ||
'https://a0.muscache.com/pictures/ca25c7f3-0d1f-432b-9efa-b9f5dc6d8770.jpg', | ||
}, | ||
{ | ||
label: '농장', | ||
imageUrl: | ||
'https://a0.muscache.com/pictures/aaa02c2d-9f0d-4c41-878a-68c12ec6c6bd.jpg', | ||
}, | ||
{ | ||
label: '시골', | ||
imageUrl: | ||
'https://a0.muscache.com/pictures/6ad4bd95-f086-437d-97e3-14d12155ddfe.jpg', | ||
}, | ||
{ | ||
label: '호숫가', | ||
imageUrl: | ||
'https://a0.muscache.com/pictures/bcd1adc0-5cee-4d7a-85ec-f6730b0f8d0c.jpg', | ||
}, | ||
{ | ||
label: '섬', | ||
imageUrl: | ||
'https://a0.muscache.com/pictures/8e507f16-4943-4be9-b707-59bd38d56309.jpg', | ||
}, | ||
{ | ||
label: '스키', | ||
imageUrl: | ||
'https://a0.muscache.com/pictures/8b44f770-7156-4c7b-b4d3-d92549c8652f.jpg', | ||
}, | ||
]; |
Oops, something went wrong.