mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
feat(core): close popup after oauth login (#10273)
This commit is contained in:
@@ -74,7 +74,7 @@ framework.impl(PopupWindowProvider, {
|
|||||||
|
|
||||||
url = `${redirectProxy}?${search.toString()}`;
|
url = `${redirectProxy}?${search.toString()}`;
|
||||||
}
|
}
|
||||||
window.open(url, '_blank', 'noreferrer noopener');
|
window.open(url, '_blank', 'popup noreferrer noopener');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
framework.impl(HapticProvider, {
|
framework.impl(HapticProvider, {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ framework.impl(PopupWindowProvider, {
|
|||||||
|
|
||||||
url = `${redirectProxy}?${search.toString()}`;
|
url = `${redirectProxy}?${search.toString()}`;
|
||||||
}
|
}
|
||||||
window.open(url, '_blank', 'noreferrer noopener');
|
window.open(url, '_blank', 'popup noreferrer noopener');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const frameworkProvider = framework.provider();
|
const frameworkProvider = framework.provider();
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
type LoaderFunction,
|
type LoaderFunction,
|
||||||
redirect,
|
redirect,
|
||||||
useLoaderData,
|
useLoaderData,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
||||||
useNavigate,
|
useNavigate,
|
||||||
} from 'react-router-dom';
|
} from 'react-router-dom';
|
||||||
|
|
||||||
@@ -76,9 +75,8 @@ export const Component = () => {
|
|||||||
triggeredRef.current = true;
|
triggeredRef.current = true;
|
||||||
auth
|
auth
|
||||||
.signInOauth(data.code, data.state, data.provider)
|
.signInOauth(data.code, data.state, data.provider)
|
||||||
.then(({ redirectUri }) => {
|
.then(() => {
|
||||||
// TODO(@forehalo): need a good way to go back to previous tab and close current one
|
window.close();
|
||||||
nav(redirectUri ?? '/');
|
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
nav(`/sign-in?error=${encodeURIComponent(e.message)}`);
|
nav(`/sign-in?error=${encodeURIComponent(e.message)}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user