feat(core): close popup after oauth login (#10273)

This commit is contained in:
EYHN
2025-02-19 14:44:02 +08:00
committed by GitHub
parent b50e507fc5
commit c0cc4224bb
3 changed files with 4 additions and 6 deletions

View File

@@ -4,7 +4,6 @@ import {
type LoaderFunction,
redirect,
useLoaderData,
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
useNavigate,
} from 'react-router-dom';
@@ -76,9 +75,8 @@ export const Component = () => {
triggeredRef.current = true;
auth
.signInOauth(data.code, data.state, data.provider)
.then(({ redirectUri }) => {
// TODO(@forehalo): need a good way to go back to previous tab and close current one
nav(redirectUri ?? '/');
.then(() => {
window.close();
})
.catch(e => {
nav(`/sign-in?error=${encodeURIComponent(e.message)}`);