fix: logout jump to 404

This commit is contained in:
DiamondThree
2023-02-07 22:14:49 +08:00
parent d9d60197f2
commit 731deda1e1
6 changed files with 32 additions and 33 deletions

View File

@@ -428,7 +428,7 @@ export class AffineProvider extends BaseProvider {
token.clear();
this._channel?.disconnect();
this._wsMap.forEach(ws => ws.disconnect());
this._workspaces.clear();
this._workspaces.clear(false);
storage.removeItem('token');
}

View File

@@ -8,8 +8,8 @@ export interface WorkspaceUnitCollectionScope {
get: (workspaceId: string) => WorkspaceUnit | undefined;
list: () => WorkspaceUnit[];
add: (workspace: WorkspaceUnit | WorkspaceUnit[]) => void;
remove: (workspaceId: string | string[]) => boolean;
clear: () => void;
remove: (workspaceId: string | string[], isUpdate?: boolean) => boolean;
clear: (isUpdate?: boolean) => void;
update: (
workspaceId: string,
workspaceUnit: UpdateWorkspaceUnitParams
@@ -85,7 +85,7 @@ export class WorkspaceUnitCollection {
]);
};
const remove = (workspaceId: string | string[]) => {
const remove = (workspaceId: string | string[], isUpdate = true) => {
const workspaceIds = Array.isArray(workspaceId)
? workspaceId
: [workspaceId];
@@ -111,18 +111,19 @@ export class WorkspaceUnitCollection {
if (!workspaceUnits.length) {
return false;
}
this._events.emit('change', [
{
deleted: workspaceUnits,
} as WorkspaceUnitCollectionChangeEvent,
]);
if (isUpdate) {
this._events.emit('change', [
{
deleted: workspaceUnits,
} as WorkspaceUnitCollectionChangeEvent,
]);
}
return true;
};
const clear = () => {
remove(Array.from(scopedWorkspaceIds));
const clear = (isUpdate = true) => {
remove(Array.from(scopedWorkspaceIds), isUpdate);
};
const update = (workspaceId: string, meta: UpdateWorkspaceUnitParams) => {