mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-22 04:21:40 +08:00
refactor: remove sync binary (#1297)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { createAffineProviders } from '../../blocksuite';
|
||||
import { Unreachable } from '../../components/affine/affine-error-eoundary';
|
||||
import {
|
||||
AffineRemoteUnSyncedWorkspace,
|
||||
RemWorkspaceFlavour,
|
||||
transformToAffineSyncedWorkspace,
|
||||
} from '../../shared';
|
||||
import { apis } from '../../shared/apis';
|
||||
import { createEmptyBlockSuiteWorkspace } from '../../utils';
|
||||
@@ -42,26 +42,17 @@ export const fetcher = async (
|
||||
if (query === QueryKey.getWorkspaces) {
|
||||
return apis.getWorkspaces().then(workspaces => {
|
||||
return workspaces.map(workspace => {
|
||||
const blockSuiteWorkspace = createEmptyBlockSuiteWorkspace(
|
||||
workspace.id,
|
||||
(k: string) =>
|
||||
// fixme: token could be expired
|
||||
({ api: '/api/workspace', token: apis.auth.token }[k])
|
||||
);
|
||||
const remWorkspace: AffineRemoteUnSyncedWorkspace = {
|
||||
...workspace,
|
||||
flavour: RemWorkspaceFlavour.AFFINE,
|
||||
firstBinarySynced: false,
|
||||
blockSuiteWorkspace: createEmptyBlockSuiteWorkspace(
|
||||
workspace.id,
|
||||
(k: string) =>
|
||||
// fixme: token could be expired
|
||||
({ api: '/api/workspace', token: apis.auth.token }[k])
|
||||
),
|
||||
syncBinary: async () => {
|
||||
const binary = await apis.downloadWorkspace(
|
||||
workspace.id,
|
||||
workspace.public
|
||||
);
|
||||
if (remWorkspace.firstBinarySynced) {
|
||||
return null;
|
||||
}
|
||||
return transformToAffineSyncedWorkspace(remWorkspace, binary);
|
||||
},
|
||||
blockSuiteWorkspace,
|
||||
providers: [...createAffineProviders(blockSuiteWorkspace)],
|
||||
};
|
||||
return remWorkspace;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user