authority.js 455 Bytes
Newer Older
ddcat1115's avatar
ddcat1115 committed
1 2
// use localStorage to store the authority info, which might be sent from server in actual project.
export function getAuthority() {
3
  // return localStorage.getItem('antd-pro-authority') || ['admin', 'user'];
rongxingsun's avatar
rongxingsun committed
4 5
  const authority = localStorage.getItem('antd-pro-authority');
  return authority ? JSON.parse(authority) : 'admin';
ddcat1115's avatar
ddcat1115 committed
6 7 8
}

export function setAuthority(authority) {
rongxingsun's avatar
rongxingsun committed
9
  return localStorage.setItem('antd-pro-authority', JSON.stringify(authority));
ddcat1115's avatar
ddcat1115 committed
10
}