From 76a83fd60bfbe694c17d2426202b3ccc57ee3e8b Mon Sep 17 00:00:00 2001 From: Himself65 Date: Mon, 6 Mar 2023 18:28:49 -0600 Subject: [PATCH] fix: prefix url (#1361) --- apps/web/src/atoms/public-workspace/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/web/src/atoms/public-workspace/index.ts b/apps/web/src/atoms/public-workspace/index.ts index adffc93d29..b7032955fd 100644 --- a/apps/web/src/atoms/public-workspace/index.ts +++ b/apps/web/src/atoms/public-workspace/index.ts @@ -12,9 +12,16 @@ export const publicBlockSuiteAtom = atom>( 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,