Skip to content

Commit

Permalink
chore: update types
Browse files Browse the repository at this point in the history
  • Loading branch information
ooooorobo committed Aug 17, 2024
1 parent 7abcf7f commit bec8cb9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
18 changes: 9 additions & 9 deletions assets/api-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ paths:
tags:
- auth-controller
operationId: refreshToken
parameters:
- name: refreshToken
in: cookie
required: true
schema:
type: string
requestBody:
content:
application/json:
Expand All @@ -150,7 +156,7 @@ paths:
content:
'*/*':
schema:
$ref: '#/components/schemas/UserTokenDto'
$ref: '#/components/schemas/AccessTokenResponse'
/api/v1/auth/logout:
post:
tags:
Expand Down Expand Up @@ -274,7 +280,7 @@ paths:
content:
'*/*':
schema:
$ref: '#/components/schemas/UserTokenDto'
$ref: '#/components/schemas/AccessTokenResponse'
/api/v1/auth/info:
get:
tags:
Expand Down Expand Up @@ -965,23 +971,17 @@ components:
RefreshTokenRequest:
required:
- accessToken
- refreshToken
type: object
properties:
accessToken:
type: string
refreshToken:
type: string
UserTokenDto:
AccessTokenResponse:
required:
- accessToken
- refreshToken
type: object
properties:
accessToken:
type: string
refreshToken:
type: string
InfoToShareIdealPartner:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion src/app/routes/auth.kakao.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function KakaoAuthPage() {
const response = await loginKakao({
code,
});
const token = response.data.accessToken;
const token = response.accessToken;
useAuthStore.getState().login(token);
location.href = '/';
} catch (e) {
Expand Down
8 changes: 3 additions & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,12 @@ export interface InfoToShareResponse {
userInfo: InfoToShareUserInfo;
}

export interface UserTokenDto {
export interface AccessTokenResponse {
accessToken: string;
refreshToken: string;
}

export interface RefreshTokenRequest {
accessToken: string;
refreshToken: string;
}

export interface ImageDto {
Expand Down Expand Up @@ -1035,7 +1033,7 @@ formData.append('image', uploadImageBody.image)
export const refreshToken = (
refreshTokenRequest: RefreshTokenRequest,
options?: SecondParameter<typeof customInstance>,) => {
return customInstance<UserTokenDto>(
return customInstance<AccessTokenResponse>(
{url: `/api/v1/auth/refresh-token`, method: 'POST',
headers: {'Content-Type': 'application/json', },
data: refreshTokenRequest
Expand Down Expand Up @@ -1109,7 +1107,7 @@ export const getAddress = (
export const loginKakao = (
params: LoginKakaoParams,
options?: SecondParameter<typeof customInstance>,) => {
return customInstance<UserTokenDto>(
return customInstance<AccessTokenResponse>(
{url: `/api/v1/auth/kakao/login`, method: 'GET',
params
},
Expand Down

0 comments on commit bec8cb9

Please sign in to comment.