Skip to content

Commit

Permalink
hotfix: 재발급시 받은 데이터 저장 로직 수정 (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwonh423 authored Sep 19, 2023
1 parent d5df4bb commit 06445d4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/src/apis/getApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ async function refreshToken(headers: Headers): Promise<string> {
throw new Error('Failed to refresh access token.');
}

console.log('refreshResponse', refreshResponse);
console.log('refreshResponse.text()', refreshResponse.text());
// 새로운 엑세스 토큰을 반환합니다.
return await refreshResponse.text();
const responseBody = await refreshResponse.json();
return responseBody.accessToken;
} catch (error) {
// 네트워크 요청 실패 또는 예외 발생 시 예외를 캐치하여 처리합니다.
console.error('네트워크 요청 실패 또는 예외 발생:', error);
Expand All @@ -57,6 +56,7 @@ async function withTokenRefresh<T>(callback: () => Promise<T>): Promise<T> {
console.log(`Authorization : Bearer ${userToken}`);
//새로운 토큰 재발급
userToken = await refreshToken(headers);

console.log('L59 userToken', userToken);
localStorage.setItem('userToken', userToken);
console.log('localStorage에 새로운 토큰 적용 성공!');
Expand Down

0 comments on commit 06445d4

Please sign in to comment.