fix(workspace): check affine login auth (#2070)

This commit is contained in:
Himself65
2023-04-21 20:44:29 -05:00
committed by GitHub
parent 2c95a0a757
commit 1ca9fb8ff4
19 changed files with 211 additions and 73 deletions
@@ -20,6 +20,19 @@ export function useSyncRouterWithCurrentWorkspaceId(router: NextRouter) {
return;
}
if (currentWorkspaceId) {
if (currentWorkspaceId !== workspaceId) {
const target = metadata.find(workspace => workspace.id === workspaceId);
if (!target) {
// workspaceId is invalid, redirect to currentWorkspaceId
void router.push({
pathname: router.pathname,
query: {
...router.query,
workspaceId: currentWorkspaceId,
},
});
}
}
return;
}
const targetWorkspace = metadata.find(