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

@@ -74,7 +74,7 @@ framework.impl(PopupWindowProvider, {
url = `${redirectProxy}?${search.toString()}`;
}
window.open(url, '_blank', 'noreferrer noopener');
window.open(url, '_blank', 'popup noreferrer noopener');
},
});
framework.impl(HapticProvider, {

View File

@@ -69,7 +69,7 @@ framework.impl(PopupWindowProvider, {
url = `${redirectProxy}?${search.toString()}`;
}
window.open(url, '_blank', 'noreferrer noopener');
window.open(url, '_blank', 'popup noreferrer noopener');
},
});
const frameworkProvider = framework.provider();

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