Skip to content

Commit

Permalink
feat: refreshToken을 재요청할때 body에 accessToken을 추가 (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwonh423 authored Sep 19, 2023
1 parent d2e5331 commit 9663453
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/src/apis/getApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ async function refreshToken(headers: Headers): Promise<string> {
const refreshResponse = await fetch(`${DEFAULT_PROD_URL}/refresh-token`, {
method: 'POST',
headers,
body: JSON.stringify({
accessToken: localStorage.getItem('userToken'),
}),
});

if (!refreshResponse.ok) {
console.log('refreshResponse.ok하지 못함');
throw new Error('Failed to refresh access token.');
}
console.log('refreshResponse', refreshResponse);
Expand Down Expand Up @@ -78,7 +82,7 @@ export const getApi = async <T>(url: string) => {
}

const responseData: T = await response.json();

console.log('responseData L84까지 성공', responseData);
return responseData;
});
};

0 comments on commit 9663453

Please sign in to comment.