소스 검색

bugfix: auto reload Authorized

ref #5416
chenshuai2144 6 년 전
부모
커밋
48d8e6b150
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/utils/authority.ts

+ 4 - 0
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));
 }