Skip to content

Commit

Permalink
refactor: signin system refrash token 추가 (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
selfishAltruism committed Feb 24, 2024
1 parent e94f195 commit 4d6c426
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/stores/repositories/AuthRepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ import { AxiosResponse } from 'axios';

import { UserModel } from '../models/UserModel';

import { API, setAuth, storeAuth } from '@/configs/axios';
import { API, setAuth, storeAuth, storeRefresh } from '@/configs/axios';

class AuthRepo {
URI = '/api/v1/users';

signIn = async (body: User.SignInRequestDto) => {
const { data: token } = (await API.post(`${this.URI}/sign-in`, body)) as AxiosResponse<string>;

storeAuth(true, token);
setAuth(token);
const { data } = (await API.post(`${this.URI}/sign-in`, body)) as AxiosResponse<{
accessToken: string;
refreshToken: string;
}>;

storeAuth(true, data.accessToken);
setAuth(data.accessToken);
storeRefresh(data.refreshToken);
};

isDuplicatedEmail = async (email: string): Promise<boolean> => {
Expand Down

0 comments on commit 4d6c426

Please sign in to comment.