Skip to content

Commit

Permalink
fix: 배포시 로그인 안되는 오류 수정 (api route 삭제)
Browse files Browse the repository at this point in the history
  • Loading branch information
gyeongza committed Jun 24, 2024
1 parent a50da90 commit 9f3e473
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 38 deletions.
35 changes: 0 additions & 35 deletions src/app/api/token/route.ts

This file was deleted.

8 changes: 5 additions & 3 deletions src/features/auth/api/oauth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from 'axios';
import { ACCESS_TOKEN_LOCAL_STORAGE_KEY } from '../constants';
import LocalStorage from '@/shared/utils/localStorage';
import instance from '@/shared/api/axios/instance';
import { API_BASE_URL } from '@/shared/api/constants';

export const getAccessToken = () => LocalStorage.getItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);

Expand All @@ -17,9 +18,10 @@ export const logout = () => {

export const getLoginToken = async (code: string) => {
try {
const response = await axios.get(`/api/token?code=${code}`);
const response = await instance.get(`${API_BASE_URL}/api/v1/oauth/login/kakao?code=${code}`);
const jwt = response.headers?.['authorization'] as string;

saveAccessToken(response.data as string);
saveAccessToken(jwt);
} catch (error) {
alert('로그인 실패:');
console.error(error);
Expand Down

0 comments on commit 9f3e473

Please sign in to comment.