-
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 pull request #160 from Make-A-Wish-Sopt/feature/159-API
Feature/159 api
- Loading branch information
Showing
94 changed files
with
1,534 additions
and
1,450 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { API_VERSION_01, PATH_AUTH } from './path'; | ||
import { client } from './common/axios'; | ||
|
||
export const postAuthKakao = async (code: string) => { | ||
const data = await client.post( | ||
`${API_VERSION_01}${PATH_AUTH.KAKAO}?redirectUri=${process.env.NEXT_PUBLIC_KAKAO_REDIRECT_URI}`, | ||
{}, | ||
{ | ||
headers: { | ||
'Content-Type': 'application/json', | ||
code: `${code}`, | ||
}, | ||
}, | ||
); | ||
|
||
return data.data.data; | ||
}; |
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,35 @@ | ||
import { getAccessToken } from '@/utils/common/token'; | ||
import { client } from './common/axios'; | ||
import { API_VERSION_01, PATH_CAKES } from './path'; | ||
|
||
const ACCESS_TOKEN = getAccessToken(); | ||
|
||
/** | ||
* 해당 소원에 대한 케이크 조회 | ||
*/ | ||
export const getCakesInfo = async ( | ||
wishId: string | string[] | undefined, | ||
cakeId: string | string[] | undefined, | ||
) => { | ||
const data = await client.get(`${API_VERSION_01}${PATH_CAKES.GET_CAKES_INFO(wishId, cakeId)}`, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${ACCESS_TOKEN}`, | ||
}, | ||
}); | ||
|
||
return data.data.data; | ||
}; | ||
|
||
/** | ||
* 해당 소원에 대한 모든 케이크 리스트 결과 조회 | ||
*/ | ||
export const getCakesResult = async (wishId: string | string[] | undefined) => { | ||
const data = await client.get(`${API_VERSION_01}${PATH_CAKES.GET_CAKES_RESULT(wishId)}`, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${ACCESS_TOKEN}`, | ||
}, | ||
}); | ||
return data.data.data; | ||
}; |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import PATH from '@/constant/path'; | ||
import axios from 'axios'; | ||
|
||
//서버통신 함수 | ||
|
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,25 @@ | ||
import axios from 'axios'; | ||
import { client } from './common/axios'; | ||
import { API_VERSION_01 } from './path'; | ||
import { getAccessToken } from '@/utils/common/token'; | ||
|
||
export const uploadPresignedURL = async (signedURL: string, file: File | Blob | null) => { | ||
const data = await axios.put(signedURL, file, { | ||
headers: { | ||
'Content-Type': file?.type, | ||
}, | ||
}); | ||
|
||
return data; | ||
}; | ||
|
||
export const getPresignedURL = async (fileName: string | undefined) => { | ||
const data = await client.get(`${API_VERSION_01}/file?fileName=${fileName}`, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${getAccessToken()}`, | ||
}, | ||
}); | ||
|
||
return data; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,41 @@ | ||
export const API_VERSION_01 = '/api/v1'; | ||
|
||
const PATH = { | ||
auth: '/auth', | ||
user: '/user', | ||
wishes: '/wishes', | ||
public: '/public', | ||
cakes: '/cakes', | ||
}; | ||
|
||
export const PATH_AUTH = { | ||
TOKEN: `${PATH.auth}/token`, | ||
KAKAO: `${PATH.auth}/kakao/callback`, | ||
}; | ||
|
||
export const PATH_USER = { | ||
DEFAULT: PATH.user, | ||
ACCOUNT: `${PATH.user}/account`, | ||
ACCOUNT_VERIFY: `${PATH.user}/verify-account`, | ||
ABUSE: `${PATH.user}/abuse`, | ||
}; | ||
|
||
export const PATH_WISHES = { | ||
DEFAULT: PATH.wishes, | ||
PROGRESS: `${PATH.wishes}/progress`, | ||
GET_SINGLE_WISH_INFO: (wishId: string | string[] | undefined) => `${PATH.wishes}/${wishId}`, | ||
PRESENT_LINK_INFO: `${PATH.wishes}/present/info`, | ||
MAIN: `${PATH.wishes}/main`, | ||
}; | ||
|
||
export const PATH_PUBLIC = { | ||
CAKES: `${PATH.public}/cakes`, | ||
GET_WISHES_INFO: (wishId: string | string[] | undefined) => | ||
`${PATH.public}${PATH.wishes}/${wishId}`, | ||
}; | ||
|
||
export const PATH_CAKES = { | ||
GET_CAKES_RESULT: (wishId: string | string[] | undefined) => `${PATH.cakes}/${wishId}`, | ||
GET_CAKES_INFO: (wishId: string | string[] | undefined, cakeId: string | string[] | undefined) => | ||
`${PATH.cakes}/${wishId}/${cakeId}`, | ||
}; |
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,11 @@ | ||
import { PublicWishesDataResponseType } from '@/types/api/response'; | ||
import { client } from './common/axios'; | ||
import { API_VERSION_01, PATH_PUBLIC } from './path'; | ||
|
||
export const getPublicWishes = async (wishId: string | string[] | undefined) => { | ||
const data = await client.get<PublicWishesDataResponseType>( | ||
`${API_VERSION_01}${PATH_PUBLIC.GET_WISHES_INFO(wishId)}`, | ||
); | ||
|
||
return data.data.data; | ||
}; |
Oops, something went wrong.