-
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.
Browse files
Browse the repository at this point in the history
[Feat] 로그인/회원가입 API 연동
- Loading branch information
Showing
19 changed files
with
369 additions
and
92 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 |
---|---|---|
@@ -1,9 +1,25 @@ | ||
import Axios from "../axios"; | ||
|
||
export async function postKakaoToken(accessToken: string): Promise<void> { | ||
await Axios.post("/api/v1/auth/login/KAKAO", { | ||
accessToken: accessToken, | ||
}); | ||
interface PostKakaoTokenResponse { | ||
accessToken?: string; | ||
refreshToken?: string; | ||
registerToken?: string; | ||
} | ||
|
||
export async function postKakaoToken( | ||
accessToken: string | ||
): Promise<PostKakaoTokenResponse> { | ||
try { | ||
const response = await Axios.post<PostKakaoTokenResponse>( | ||
"/api/v1/auth/login/KAKAO", | ||
{ | ||
accessToken: accessToken, | ||
} | ||
); | ||
return response.data; | ||
} catch (error) { | ||
throw new Error("Failed to login with Kakao: " + error); | ||
} | ||
} | ||
|
||
export default postKakaoToken; |
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,9 +1,17 @@ | ||
import { TokenResponse } from "@/interface/Auth"; | ||
import Axios from "../axios"; | ||
|
||
export async function putTokenReissue(refreshToken: string): Promise<void> { | ||
await Axios.put("/api/v1/auth/reissue", { | ||
refreshToken: refreshToken, | ||
}); | ||
export async function putTokenReissue( | ||
refreshToken: string | ||
): Promise<TokenResponse> { | ||
try { | ||
const response = await Axios.put<TokenResponse>("/api/v1/auth/reissue", { | ||
refreshToken: refreshToken, | ||
}); | ||
return response.data; | ||
} catch (error) { | ||
throw new Error("Failed to reissue token: " + error); | ||
} | ||
} | ||
|
||
export default putTokenReissue; |
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,13 @@ | ||
import { PostUserRequest, TokenResponse } from "@/interface/Auth"; | ||
import Axios from "../axios"; | ||
|
||
export async function postUser(user: PostUserRequest): Promise<TokenResponse> { | ||
try { | ||
const response = await Axios.post<TokenResponse>("/api/v1/users", user); | ||
return response.data; | ||
} catch (error) { | ||
throw new Error("Failed to register user: " + error); | ||
} | ||
} | ||
|
||
export default postUser; |
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
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.