我正在用pro学着开发项目,现在在弄权限问题,我希望第一次打开localhost:8000应该是登录界面,无论在地址栏输入什么地址都只会在登录界面。但现在pro是直接重定向到了某个页面,不需要登录。除非是点了退出登录后,再次打开localhost:8000才会有登录界面。我应该如何处理?
Translation of this issue:
I'm learning development projects with pro. Now I'm working on permissions. I hope to open localhost:8000 for the first time. It should be the login interface. No matter what address is entered in the address bar, it will only be in the login interface. But now pro is directly redirected to a page and does not require login. Unless it is a point to log out, open localhost:8000 again will have a login screen. What should I do?
修改 utils/authority.js,将默认角色删除
// 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';
+ return localStorage.getItem('antd-pro-authority');
}
export function setAuthority(authority) {
return localStorage.setItem('antd-pro-authority', authority);
}
thank u @u3u
你的问题解决了吗?为啥我照着 @u3u 的改了 ,localhost:8000出来还是一个首页而不是登陆页
@XYStudy 清理下localStorage
Most helpful comment
修改
utils/authority.js,将默认角色删除