Commit 57fb525e authored by rongxingsun's avatar rongxingsun Committed by 陈帅

localStorage array

localStorage  array
parent d00bec8c
// 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'];
return localStorage.getItem('antd-pro-authority') || 'admin';
const authority = localStorage.getItem('antd-pro-authority');
return authority ? JSON.parse(authority) : 'admin';
}
export function setAuthority(authority) {
return localStorage.setItem('antd-pro-authority', authority);
return localStorage.setItem('antd-pro-authority', JSON.stringify(authority));
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment