From 48d8e6b15021e371bfe8c800668a3be0eb55e101 Mon Sep 17 00:00:00 2001 From: chenshuai2144 Date: Tue, 15 Oct 2019 23:21:51 +0800 Subject: [PATCH] bugfix: auto reload Authorized ref #5416 --- src/utils/authority.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/authority.ts b/src/utils/authority.ts index 35c1f386..ffa91788 100644 --- a/src/utils/authority.ts +++ b/src/utils/authority.ts @@ -1,3 +1,5 @@ +import { reloadAuthorized } from './Authorized'; + // use localStorage to store the authority info, which might be sent from server in actual project. export function getAuthority(str?: string): string | string[] { // return localStorage.getItem('antd-pro-authority') || ['admin', 'user']; @@ -25,5 +27,7 @@ export function getAuthority(str?: string): string | string[] { export function setAuthority(authority: string | string[]): void { const proAuthority = typeof authority === 'string' ? [authority] : authority; + // auto reload + reloadAuthorized(); return localStorage.setItem('antd-pro-authority', JSON.stringify(proAuthority)); }