Skip to content
This repository has been archived by the owner on Dec 15, 2024. It is now read-only.

Commit

Permalink
fix(auth): 토큰 저장방식 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
5ewon committed Apr 27, 2024
1 parent 0782c10 commit db1c61b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions apps/wiki/services/auth/auth.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { refreshToken } from "@/apis/header";
import { TOKEN } from "@/constants";
import { Storage } from "@/storage";

export const refresh = async () => {
const { data } = await http.put("/auth/refresh/access", null, refreshToken());
export const refresh = async (authCode: string) => {
const { data } = await http.put("/auth/refresh/access", { accessToken: authCode });
Storage.setItem(TOKEN.ACCESS, data.accessToken);
return data.accessToken;
};
Expand Down
4 changes: 2 additions & 2 deletions apps/wiki/services/auth/auth.mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const useLoginMutation = () => {
return useMutation({
mutationFn: requestLogin,
onSuccess: ({ accessToken, refreshToken }) => {
Storage.setItem(TOKEN.ACCESS, accessToken);
Storage.setItem(TOKEN.REFRESH, refreshToken);
Storage.setItem(TOKEN.ACCESS, `Bearer ${accessToken}`);
Storage.setItem(TOKEN.REFRESH, `Bearer ${refreshToken}`);
window.history.go(-2);
},
});
Expand Down

0 comments on commit db1c61b

Please sign in to comment.