fix: prefix url (#1361)

This commit is contained in:
Himself65 2023-03-06 18:28:49 -06:00 committed by GitHub
parent 0f82851766
commit 76a83fd60b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,9 +12,16 @@ export const publicBlockSuiteAtom = atom<Promise<BlockSuiteWorkspace>>(
throw new Error('No workspace id');
}
const binary = await apis.downloadWorkspace(workspaceId, true);
// fixme: this is a hack
const params = new URLSearchParams(window.location.search);
const prefixUrl = params.get('prefixUrl')
? (params.get('prefixUrl') as string)
: '/';
const blockSuiteWorkspace = createEmptyBlockSuiteWorkspace(
workspaceId,
(_: string) => undefined
(k: string) =>
// fixme: token could be expired
({ api: `${prefixUrl}api/workspace`, token: apis.auth.token }[k])
);
BlockSuiteWorkspace.Y.applyUpdate(
blockSuiteWorkspace.doc,