fix(workspace): check session before get workspaces (#5621)

This commit is contained in:
EYHN 2024-01-18 04:46:51 +00:00
parent aa437bcd35
commit 74a3a795bd
No known key found for this signature in database
GPG Key ID: 46C9E26A75AB276C

View File

@ -10,6 +10,7 @@ import { globalBlockSuiteSchema } from '@affine/workspace';
import { Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
import { difference } from 'lodash-es';
import { nanoid } from 'nanoid';
import { getSession } from 'next-auth/react';
import { applyUpdate, encodeStateAsUpdate } from 'yjs';
import { createLocalBlobStorage } from '../local/blob';
@ -18,6 +19,10 @@ import { CLOUD_WORKSPACE_CHANGED_BROADCAST_CHANNEL_KEY } from './consts';
import { createAffineStaticStorage } from './sync';
async function getCloudWorkspaceList() {
const session = await getSession();
if (!session) {
return [];
}
try {
const { workspaces } = await fetcher({
query: getWorkspacesQuery,