fix: login and upload affine workspace in one run (#1662)

This commit is contained in:
Himself65 2023-03-22 22:29:25 -05:00 committed by GitHub
parent 8ed40bfae9
commit 35d4560e9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,10 +110,10 @@ const SettingPage: NextPageWithLayout = () => {
to: To,
workspace: FlavourToWorkspace[From]
): Promise<void> => {
if (to === RemWorkspaceFlavour.AFFINE && !apis.auth.isLogin) {
const needRefresh =
to === RemWorkspaceFlavour.AFFINE && !apis.auth.isLogin;
if (needRefresh) {
await apis.signInWithGoogle();
router.reload();
return;
}
const workspaceId = await transformWorkspace(from, to, workspace);
await router.replace({
@ -123,6 +123,9 @@ const SettingPage: NextPageWithLayout = () => {
workspaceId,
},
});
if (needRefresh) {
router.reload();
}
},
[router, transformWorkspace]
);