@@ -25,6 +25,7 @@ import {
2525 getUserPermissionByToken ,
2626} from "../services/api" ;
2727import { getIntlContent } from "../utils/IntlUtils" ;
28+ import { defaultNamespaceId } from "../components/_utils/utils" ;
2829
2930export default {
3031 namespace : "global" ,
@@ -37,7 +38,7 @@ export default {
3738 permissions : { } ,
3839 language : "" ,
3940 namespaces : [ ] ,
40- currentNamespaceId : "649330b6-c2d7-4edc-be8e-8a54df9eb385" ,
41+ currentNamespaceId : defaultNamespaceId ,
4142 } ,
4243
4344 effects : {
@@ -57,9 +58,6 @@ export default {
5758 type : "saveNamespaces" ,
5859 payload : json . data ,
5960 } ) ;
60- const namespaceId =
61- json . data [ 0 ] ?. namespaceId || "649330b6-c2d7-4edc-be8e-8a54df9eb385" ;
62- window . sessionStorage . setItem ( "currentNamespaceId" , namespaceId ) ;
6361 }
6462 } ,
6563 * fetchPlugins ( { payload } , { call, put } ) {
@@ -92,11 +90,13 @@ export default {
9290 message . warn ( json . message ) ;
9391 }
9492 } ,
95- * fetchPermission ( { payload } , { call, put } ) {
93+ * fetchPermission ( { payload } , { call, put, select } ) {
9694 const { callback } = payload ;
9795 let permissions = { menu : [ ] , button : [ ] } ;
9896 const token = window . sessionStorage . getItem ( "token" ) ;
99- const namespaceId = window . sessionStorage . getItem ( "currentNamespaceId" ) ;
97+ const namespaceId = yield select (
98+ ( { global } ) => global . currentNamespaceId ,
99+ ) ;
100100 if ( namespaceId ) {
101101 const params = { token, namespaceId } ;
102102 const json = yield call ( getUserPermissionByToken , params ) ;
0 commit comments