diff --git a/src/pages/system/menus/store.ts b/src/pages/system/menus/store.ts index a64c384..2092cbc 100644 --- a/src/pages/system/menus/store.ts +++ b/src/pages/system/menus/store.ts @@ -1,5 +1,5 @@ import systemServ from '@/service/system.ts' -import { IPage, IPageResult, MenuItem } from '@/types' +import { IApiResult, IPage, MenuItem } from '@/types' import { IMenu } from '@/types/menus' import { atomWithMutation, atomWithQuery, queryClientAtom } from 'jotai-tanstack-query' import { atom, createStore } from 'jotai' @@ -24,15 +24,15 @@ export const menuPageAtom = atom({}) const store = createStore() -export const menuDataAtom = atomWithQuery>((get) => { +export const menuDataAtom = atomWithQuery((get) => { return { queryKey: [ 'menus', get(menuPageAtom) ], queryFn: async ({ queryKey: [ , page ] }) => { return await systemServ.menus.list(page) }, - select: (data) => { - return data.rows ?? [] + select: (res) => { + return res.data.rows ?? [] } } }) @@ -49,7 +49,7 @@ export const byIdMenuAtom = atomWithQuery((get) => ({ })) -export const saveOrUpdateMenuAtom = atomWithMutation((get) => { +export const saveOrUpdateMenuAtom = atomWithMutation((get) => { return { mutationKey: [ 'updateMenu', get(selectedMenuIdAtom) ], diff --git a/src/pages/system/menus/style.ts b/src/pages/system/menus/style.ts index 59194e7..e0afef4 100644 --- a/src/pages/system/menus/style.ts +++ b/src/pages/system/menus/style.ts @@ -60,7 +60,7 @@ export const useStyle = createStyles(({ token, css, cx, prefixCls }) => { ` const treeActions = css` - padding: 0 10px 10px; + padding: 0 24px 16px; display: flex; flex-direction: column; position: sticky; diff --git a/src/pages/system/roles/store.ts b/src/pages/system/roles/store.ts index 1a41dfd..4564f6b 100644 --- a/src/pages/system/roles/store.ts +++ b/src/pages/system/roles/store.ts @@ -2,7 +2,7 @@ import { convertToBool } from '@/utils' import { atom } from 'jotai/index' import { IRole } from '@/types/roles' import { atomWithMutation, atomWithQuery, queryClientAtom } from 'jotai-tanstack-query' -import { IPage } from '@/types' +import { IApiResult, IPage } from '@/types' import systemServ from '@/service/system.ts' import { message } from 'antd' import { t } from '@/i18n.ts' @@ -45,7 +45,7 @@ export const rolesAtom = atomWithQuery((get) => { //saveOrUpdateRoleAtom -export const saveOrUpdateRoleAtom = atomWithMutation((get) => { +export const saveOrUpdateRoleAtom = atomWithMutation((get) => { return { mutationKey: [ 'updateMenu' ],