-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feat/#126-share-link
- Loading branch information
Showing
50 changed files
with
1,777 additions
and
490 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 @@ | ||
VITE_API_URL=http://43.202.102.179:8080 |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,29 @@ | ||
import { PostAuthParams, PostAuthResponse } from "@/types/authApi"; | ||
import "@/types/lotteryApi"; | ||
import { fetchWithTimeout } from "@/utils/fetchWithTimeout"; | ||
|
||
const baseURL = `${import.meta.env.VITE_API_URL}/admin/auth`; | ||
const headers = { | ||
"Content-Type": "application/json", | ||
}; | ||
|
||
export const AuthAPI = { | ||
async postAuth(body: PostAuthParams): Promise<PostAuthResponse> { | ||
try { | ||
return new Promise((resolve) => | ||
resolve({ | ||
accessToken: "access token", | ||
}) | ||
); | ||
const response = await fetchWithTimeout(`${baseURL}`, { | ||
method: "POST", | ||
headers: headers, | ||
body: JSON.stringify(body), | ||
}); | ||
return response.json(); | ||
} catch (error) { | ||
console.error("Error:", error); | ||
throw error; | ||
} | ||
}, | ||
}; |
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,138 @@ | ||
import { | ||
GetLotteryExpectationsParams, | ||
GetLotteryExpectationsResponse, | ||
GetLotteryResponse, | ||
GetLotteryWinnerParams, | ||
GetLotteryWinnerResponse, | ||
PostLotteryWinnerResponse, | ||
} from "@/types/lotteryApi"; | ||
import { fetchWithTimeout } from "@/utils/fetchWithTimeout"; | ||
|
||
const baseURL = `${import.meta.env.VITE_API_URL}/admin/event/lottery`; | ||
const headers = { | ||
"Content-Type": "application/json", | ||
}; | ||
|
||
export const LotteryAPI = { | ||
async getLottery(): Promise<GetLotteryResponse> { | ||
try { | ||
return new Promise((resolve) => | ||
resolve([ | ||
{ | ||
lotteryEventId: 1, | ||
startDate: "2024-07-26", | ||
startTime: "00:00", | ||
endDate: "2024-08-25", | ||
endTime: "23:59", | ||
appliedCount: 1000000, | ||
winnerCount: 363, | ||
}, | ||
]) | ||
); | ||
const response = await fetchWithTimeout(`${baseURL}`, { | ||
method: "GET", | ||
headers: headers, | ||
}); | ||
return response.json(); | ||
} catch (error) { | ||
console.error("Error:", error); | ||
throw error; | ||
} | ||
}, | ||
async postLotteryWinner(): Promise<PostLotteryWinnerResponse> { | ||
try { | ||
return new Promise((resolve) => resolve({ message: "요청에 성공하였습니다." })); | ||
const response = await fetchWithTimeout(`${baseURL}/winner`, { | ||
method: "POST", | ||
headers: headers, | ||
}); | ||
return response.json(); | ||
} catch (error) { | ||
console.error("Error:", error); | ||
throw error; | ||
} | ||
}, | ||
async getLotteryWinner({ | ||
id, | ||
size, | ||
page, | ||
phoneNumber, | ||
}: GetLotteryWinnerParams): Promise<GetLotteryWinnerResponse> { | ||
try { | ||
return new Promise((resolve) => | ||
resolve({ | ||
data: [ | ||
{ | ||
id: 1, | ||
phoneNumber: "010-1111-2222", | ||
linkClickedCounts: 1, | ||
expectation: 1, | ||
appliedCount: 3, | ||
}, | ||
{ | ||
id: 2, | ||
phoneNumber: "010-1111-2223", | ||
linkClickedCounts: 1, | ||
expectation: 1, | ||
appliedCount: 3, | ||
}, | ||
{ | ||
id: 3, | ||
phoneNumber: "010-1111-2224", | ||
linkClickedCounts: 1, | ||
expectation: 1, | ||
appliedCount: 3, | ||
}, | ||
], | ||
isLastPage: false, | ||
totalParticipants: 10000, | ||
}) | ||
); | ||
const response = await fetchWithTimeout( | ||
`${baseURL}/${id}/winner?size=${size}&page=${page}&number=${phoneNumber}`, | ||
{ | ||
method: "GET", | ||
headers: headers, | ||
} | ||
); | ||
return response.json(); | ||
} catch (error) { | ||
console.error("Error:", error); | ||
throw error; | ||
} | ||
}, | ||
async getLotteryExpectations({ | ||
lotteryId, | ||
participantId, | ||
}: GetLotteryExpectationsParams): Promise<GetLotteryExpectationsResponse> { | ||
try { | ||
return new Promise((resolve) => | ||
resolve([ | ||
{ | ||
casperId: 1, | ||
expectation: "기대평 1", | ||
}, | ||
{ | ||
casperId: 2, | ||
expectation: "기대평 2", | ||
}, | ||
{ | ||
casperId: 3, | ||
expectation: "기대평 3", | ||
}, | ||
]) | ||
); | ||
const response = await fetchWithTimeout( | ||
`${baseURL}/${lotteryId}/participants/${participantId}/expectations`, | ||
{ | ||
method: "GET", | ||
headers: headers, | ||
} | ||
); | ||
return response.json(); | ||
} catch (error) { | ||
console.error("Error:", error); | ||
throw error; | ||
} | ||
}, | ||
}; |
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,147 @@ | ||
import { | ||
GetRushOptionsParams, | ||
GetRushOptionsResponse, | ||
GetRushParticipantListParams, | ||
GetRushParticipantListResponse, | ||
GetRushWinnerListParams, | ||
} from "@/types/rushApi"; | ||
import { fetchWithTimeout } from "@/utils/fetchWithTimeout"; | ||
|
||
const baseURL = `${import.meta.env.VITE_API_URL}/admin/event/rush`; | ||
const headers = { | ||
"Content-Type": "application/json", | ||
}; | ||
|
||
export const RushAPI = { | ||
async getRushParticipantList({ | ||
id, | ||
phoneNumber, | ||
size, | ||
page, | ||
option, | ||
}: GetRushParticipantListParams): Promise<GetRushParticipantListResponse> { | ||
try { | ||
return new Promise((resolve) => | ||
resolve({ | ||
data: [ | ||
{ | ||
id: 1, | ||
phoneNumber: "010-1111-2222", | ||
balanceGameChoice: option, | ||
createdAt: "2024-07-25 20:00:123", | ||
rank: 1, | ||
}, | ||
{ | ||
id: 3, | ||
phoneNumber: "010-1111-2222", | ||
balanceGameChoice: option, | ||
createdAt: "2024-07-25 20:00:125", | ||
rank: 2, | ||
}, | ||
{ | ||
id: 4, | ||
phoneNumber: "010-1111-2222", | ||
balanceGameChoice: option, | ||
createdAt: "2024-07-25 20:00:127", | ||
rank: 3, | ||
}, | ||
], | ||
isLastPage: false, | ||
totalParticipants: 10000, | ||
}) | ||
); | ||
const response = await fetchWithTimeout( | ||
`${baseURL}/${id}/participants?number=${phoneNumber}&size=${size}&page=${page}&option=${option}`, | ||
{ | ||
method: "GET", | ||
headers: headers, | ||
} | ||
); | ||
return response.json(); | ||
} catch (error) { | ||
console.error("Error:", error); | ||
throw error; | ||
} | ||
}, | ||
async getRushWinnerList({ | ||
id, | ||
phoneNumber, | ||
size, | ||
page, | ||
}: GetRushWinnerListParams): Promise<GetRushParticipantListResponse> { | ||
try { | ||
return new Promise((resolve) => | ||
resolve({ | ||
data: [ | ||
{ | ||
id: 1, | ||
phoneNumber: "010-3843-6999", | ||
balanceGameChoice: 1, | ||
createdAt: "2024-07-25 20:00:123", | ||
rank: 1, | ||
}, | ||
{ | ||
id: 3, | ||
phoneNumber: "010-1111-2222", | ||
balanceGameChoice: 1, | ||
createdAt: "2024-07-25 20:00:125", | ||
rank: 2, | ||
}, | ||
{ | ||
id: 4, | ||
phoneNumber: "010-1111-2222", | ||
balanceGameChoice: 1, | ||
createdAt: "2024-07-25 20:00:127", | ||
rank: 3, | ||
}, | ||
], | ||
isLastPage: false, | ||
totalParticipants: 10000, | ||
}) | ||
); | ||
const response = await fetchWithTimeout( | ||
`${baseURL}/${id}/participants?number=${phoneNumber}&size=${size}&page=${page}`, | ||
{ | ||
method: "GET", | ||
headers: headers, | ||
} | ||
); | ||
return response.json(); | ||
} catch (error) { | ||
console.error("Error:", error); | ||
throw error; | ||
} | ||
}, | ||
async getRushOptions({ id }: GetRushOptionsParams): Promise<GetRushOptionsResponse> { | ||
try { | ||
return new Promise((resolve) => | ||
resolve([ | ||
{ | ||
rushOptionId: 1, | ||
mainText: "첫 차로 저렴한 차 사기", | ||
subText: " 첫 차는 가성비가 짱이지!", | ||
resultMainText: "누구보다 가성비 갑인 캐스퍼 일렉트릭", | ||
resultSubText: "전기차 평균보다 훨씬 저렴한 캐스퍼 일렉트릭!", | ||
imageUrl: "left_image.png", | ||
}, | ||
{ | ||
rushOptionId: 2, | ||
mainText: "첫 차로 성능 좋은 차 사기", | ||
subText: " 차는 당연히 성능이지!", | ||
resultMainText: "필요한 건 다 갖춘 캐스퍼 일렉트릭", | ||
resultSubText: "전기차 평균보다 훨씨니 저렴한 캐스퍼 일렉트릭!", | ||
imageUrl: "left_image.png", | ||
}, | ||
]) | ||
); | ||
const response = await fetchWithTimeout(`${baseURL}/${id}/options`, { | ||
method: "GET", | ||
headers: headers, | ||
}); | ||
return response.json(); | ||
} catch (error) { | ||
console.error("Error:", error); | ||
throw error; | ||
} | ||
}, | ||
}; |
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
Oops, something went wrong.