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

View File

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