fix: check if login when enable affine cloud (#1445)

This commit is contained in:
Himself65
2023-03-09 01:26:07 -06:00
committed by GitHub
parent b23547f4bd
commit 6b533c44be
4 changed files with 41 additions and 24 deletions

View File

@@ -24,6 +24,7 @@ import {
settingPanel,
settingPanelValues,
} from '../../../shared';
import { apis } from '../../../shared/apis';
const settingPanelAtom = atomWithStorage<SettingPanel>(
'workspaceId',
@@ -107,6 +108,11 @@ const SettingPage: NextPageWithLayout = () => {
to: To,
workspace: FlavourToWorkspace[From]
): Promise<void> => {
if (to === RemWorkspaceFlavour.AFFINE && !apis.auth.isLogin) {
await apis.signInWithGoogle();
router.reload();
return;
}
const workspaceId = await transformWorkspace(from, to, workspace);
await router.replace({
pathname: `/workspace/[workspaceId]/setting`,