|
@@ -1,20 +1,10 @@
|
|
|
import {getRoleMenu} from '@apis';
|
|
|
-import {TreeRoleMenuData} from '@models';
|
|
|
+import {HOME_PATH} from '@routes';
|
|
|
import {menuStore} from '@stores';
|
|
|
import {useQuery} from '@tanstack/react-query';
|
|
|
import {sortMenu} from '@utils';
|
|
|
import {useStore} from 'zustand';
|
|
|
|
|
|
-const homeMenuData: TreeRoleMenuData = {
|
|
|
- id: '-1',
|
|
|
- name: '首页',
|
|
|
- url: '/',
|
|
|
- pId: '0',
|
|
|
- page: 1,
|
|
|
- limit: 0,
|
|
|
- orderBy: '0',
|
|
|
-};
|
|
|
-
|
|
|
export function useMenu() {
|
|
|
const setMenus = useStore(menuStore, state => state.setMenu);
|
|
|
|
|
@@ -25,7 +15,15 @@ export function useMenu() {
|
|
|
|
|
|
if (data.msg === '200') {
|
|
|
const finalMenu = [
|
|
|
- homeMenuData,
|
|
|
+ {
|
|
|
+ id: '-1',
|
|
|
+ name: '首页',
|
|
|
+ url: HOME_PATH,
|
|
|
+ pId: '0',
|
|
|
+ page: 1,
|
|
|
+ limit: 0,
|
|
|
+ orderBy: '0',
|
|
|
+ },
|
|
|
...data.data,
|
|
|
];
|
|
|
|