feat(client): allows to redirect to specific url after signout (#5583)

This commit is contained in:
YANG QIA 2024-11-05 15:38:09 +08:00 committed by GitHub
parent d68c671a12
commit 9fd136b331
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)}`);
}
},
},
];