From 7c45663cd172874e4275dcfe4c9ee1cf2dd2eb86 Mon Sep 17 00:00:00 2001 From: chenos Date: Thu, 20 Jul 2023 15:57:11 +0800 Subject: [PATCH] fix: user role not found --- packages/presets/nocobase/src/client/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/presets/nocobase/src/client/index.ts b/packages/presets/nocobase/src/client/index.ts index 4c6999be9..4c568f378 100644 --- a/packages/presets/nocobase/src/client/index.ts +++ b/packages/presets/nocobase/src/client/index.ts @@ -21,7 +21,16 @@ export class NocoBaseClientPresetPlugin extends Plugin { return config; }); this.app.pm.add(NocoBaseBuildInPlugin); - await this.loadRemotePlugin(); + try { + await this.loadRemotePlugin(); + } catch (error) { + if (401 === error?.response?.status) { + this.app.apiClient.auth.setRole(null); + window.location.reload(); + } else { + throw error; + } + } } // TODO: 现在是先远程加载远程组件的名称,然后再加载本地组件