refactor(api): remove unnecessary userId param (#675)

* refactor(api): remove unnecessary userId param

移除getUserInfo、getPermCode、getMenuList接口的userId参数。
这些接口应当始终与当前登录用户相关而无需传递userId。

* fix: fix auth header key case error
This commit is contained in:
Netfan
2021-05-29 23:11:38 +08:00
committed by GitHub
parent 70dcd60beb
commit 9e5e630987
12 changed files with 227 additions and 184 deletions

View File

@@ -41,13 +41,13 @@ export function usePermission() {
* Reset and regain authority resource information
* @param id
*/
async function resume(id?: string | number) {
async function resume() {
const tabStore = useMultipleTabStore();
tabStore.clearCacheTabs();
resetRouter();
const routes = await permissionStore.buildRoutesAction(id);
const routes = await permissionStore.buildRoutesAction();
routes.forEach((route) => {
router.addRoute((route as unknown) as RouteRecordRaw);
router.addRoute(route as unknown as RouteRecordRaw);
});
permissionStore.setLastBuildMenuTime();
closeAll();
@@ -103,12 +103,11 @@ export function usePermission() {
}
/**
* Change menu
* refresh menu data
*/
async function changeMenu(id?: string | number) {
// TODO The id passed in here is for testing. Actually, you dont need to pass it. The id of the login person will be automatically obtained.
resume(id);
async function refreshMenu() {
resume();
}
return { changeRole, hasPermission, togglePermissionMode, changeMenu };
return { changeRole, hasPermission, togglePermissionMode, refreshMenu };
}