mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
refactor: remove package @affine/datacenter (#1705)
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { getLoginStorage } from '@affine/workspace/affine/login';
|
||||
import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils';
|
||||
import { atom } from 'jotai/index';
|
||||
|
||||
import { BlockSuiteWorkspace } from '../../shared';
|
||||
import { apis } from '../../shared/apis';
|
||||
import { affineApis } from '../../shared/apis';
|
||||
|
||||
export const publicWorkspaceIdAtom = atom<string | null>(null);
|
||||
export const publicBlockSuiteAtom = atom<Promise<BlockSuiteWorkspace>>(
|
||||
@@ -11,7 +12,7 @@ export const publicBlockSuiteAtom = atom<Promise<BlockSuiteWorkspace>>(
|
||||
if (!workspaceId) {
|
||||
throw new Error('No workspace id');
|
||||
}
|
||||
const binary = await apis.downloadWorkspace(workspaceId, true);
|
||||
const binary = await affineApis.downloadWorkspace(workspaceId, true);
|
||||
// fixme: this is a hack
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const prefixUrl = params.get('prefixUrl')
|
||||
@@ -21,7 +22,9 @@ export const publicBlockSuiteAtom = atom<Promise<BlockSuiteWorkspace>>(
|
||||
workspaceId,
|
||||
(k: string) =>
|
||||
// fixme: token could be expired
|
||||
({ api: `${prefixUrl}api/workspace`, token: apis.auth.token }[k])
|
||||
({ api: `${prefixUrl}api/workspace`, token: getLoginStorage()?.token }[
|
||||
k
|
||||
])
|
||||
);
|
||||
BlockSuiteWorkspace.Y.applyUpdate(
|
||||
blockSuiteWorkspace.doc,
|
||||
|
||||
Reference in New Issue
Block a user