From 08acaf05f1b3bcf316d0a436307415d3e4fac58d Mon Sep 17 00:00:00 2001 From: Li Kui <90845831+likui628@users.noreply.github.com> Date: Wed, 28 Aug 2024 22:37:47 +0800 Subject: [PATCH] fix: solve the problem of recursive call to logout api (#4265) --- apps/web-antd/src/api/core/auth.ts | 4 +++- apps/web-ele/src/api/core/auth.ts | 4 +++- apps/web-naive/src/api/core/auth.ts | 4 +++- playground/src/api/core/auth.ts | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/web-antd/src/api/core/auth.ts b/apps/web-antd/src/api/core/auth.ts index 779bca1c..a40ff0a1 100644 --- a/apps/web-antd/src/api/core/auth.ts +++ b/apps/web-antd/src/api/core/auth.ts @@ -42,7 +42,9 @@ export async function refreshTokenApi() { * 退出登录 */ export async function logoutApi() { - return requestClient.post('/auth/logout'); + return baseRequestClient.post('/auth/logout', { + withCredentials: true, + }); } /** diff --git a/apps/web-ele/src/api/core/auth.ts b/apps/web-ele/src/api/core/auth.ts index 779bca1c..a40ff0a1 100644 --- a/apps/web-ele/src/api/core/auth.ts +++ b/apps/web-ele/src/api/core/auth.ts @@ -42,7 +42,9 @@ export async function refreshTokenApi() { * 退出登录 */ export async function logoutApi() { - return requestClient.post('/auth/logout'); + return baseRequestClient.post('/auth/logout', { + withCredentials: true, + }); } /** diff --git a/apps/web-naive/src/api/core/auth.ts b/apps/web-naive/src/api/core/auth.ts index 779bca1c..a40ff0a1 100644 --- a/apps/web-naive/src/api/core/auth.ts +++ b/apps/web-naive/src/api/core/auth.ts @@ -42,7 +42,9 @@ export async function refreshTokenApi() { * 退出登录 */ export async function logoutApi() { - return requestClient.post('/auth/logout'); + return baseRequestClient.post('/auth/logout', { + withCredentials: true, + }); } /** diff --git a/playground/src/api/core/auth.ts b/playground/src/api/core/auth.ts index 779bca1c..a40ff0a1 100644 --- a/playground/src/api/core/auth.ts +++ b/playground/src/api/core/auth.ts @@ -42,7 +42,9 @@ export async function refreshTokenApi() { * 退出登录 */ export async function logoutApi() { - return requestClient.post('/auth/logout'); + return baseRequestClient.post('/auth/logout', { + withCredentials: true, + }); } /**