From 9fd136b331fe4ed619daf13d10f7c4712f1b42fa Mon Sep 17 00:00:00 2001 From: YANG QIA <2013xile@gmail.com> Date: Tue, 5 Nov 2024 15:38:09 +0800 Subject: [PATCH] feat(client): allows to redirect to specific url after signout (#5583) --- packages/core/client/src/user/CurrentUser.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/user/CurrentUser.tsx b/packages/core/client/src/user/CurrentUser.tsx index ee369aa697..58dfae0ff9 100644 --- a/packages/core/client/src/user/CurrentUser.tsx +++ b/packages/core/client/src/user/CurrentUser.tsx @@ -139,8 +139,12 @@ export const SettingsMenu: React.FC<{ key: 'signout', label: t('Sign out'), onClick: async () => { - await api.auth.signOut(); - navigate(`/signin?redirect=${encodeURIComponent(redirectUrl)}`); + const { data } = await api.auth.signOut(); + if (data?.data?.redirect) { + window.location.href = data.data.redirect; + } else { + navigate(`/signin?redirect=${encodeURIComponent(redirectUrl)}`); + } }, }, ];