👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

19 lines
606 B

// use localStorage to store the authority info, which might be sent from server in actual project.
export function getAuthority() {
// return localStorage.getItem('antd-pro-authority') || ['admin', 'user'];
let authority = localStorage.getItem('antd-pro-authority');
if (authority) {
if (authority.includes('[')) {
authority = JSON.parse(authority);
} else {
authority = [authority];
}
} else {
authority = ['admin'];
}
return authority;
}
export function setAuthority(authority) {
return localStorage.setItem('antd-pro-authority', JSON.stringify(authority));
}