Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: #275 로그아웃시 Access Token이 포함되도록 수정 #276

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/mocks/services/authServiceHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,13 @@ const authServiceHandler = [
}),

// 로그아웃 API
http.post(`${API_URL}/user/logout`, async ({ cookies }) => {
http.post(`${API_URL}/user/logout`, async ({ request, cookies }) => {
const accessToken = request.headers.get('Authorization');
const { refreshToken } = cookies;

if (!accessToken) return new HttpResponse(null, { status: 401 });
if (!refreshToken) return new HttpResponse(null, { status: 400 });

const currentTime = Date.now();

return new HttpResponse(null, {
Expand Down
2 changes: 1 addition & 1 deletion src/services/authService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export async function getUserInfo(axiosConfig: AxiosRequestConfig = {}) {
* @returns {Promise<AxiosResponse<void>>}
*/
export async function logout(axiosConfig: AxiosRequestConfig = {}) {
return defaultAxios.post('user/logout', null, { ...axiosConfig, withCredentials: true });
return authAxios.post('user/logout', null, { ...axiosConfig, withCredentials: true });
}

/**
Expand Down