react-toolkits 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +44 -32
- package/dist/index.esm.js +159 -146
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterForm/index.tsx +1 -0
- package/src/components/FormModal/hooks.tsx +2 -3
- package/src/components/FormModal/index.tsx +11 -12
- package/src/components/QueryList/index.tsx +8 -21
- package/src/constants/index.ts +0 -2
- package/src/features/permission/hooks/index.ts +13 -28
- package/src/hooks/index.ts +1 -1
- package/src/hooks/{use-fetcher.tsx → use-http-client.tsx} +16 -42
- package/src/hooks/use-permission.tsx +13 -4
- package/src/index.ts +1 -0
- package/src/layouts/Layout.tsx +75 -37
- package/src/layouts/NavBar.tsx +8 -21
- package/src/pages/Login/index.tsx +3 -0
- package/src/pages/NoMatch/index.tsx +27 -0
- package/src/pages/index.ts +2 -1
- package/src/pages/permission/RoleList.tsx +11 -11
- package/src/types/index.ts +0 -17
package/src/pages/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Highlight, PermissionButton, QueryList } from '@/components'
|
|
|
2
2
|
import { useFormModal } from '@/components/FormModal/hooks'
|
|
3
3
|
import type { Role, RoleListItem } from '@/features/permission'
|
|
4
4
|
import { PermissionList, useCreateRole, useRemoveRole, useUpdateRole } from '@/features/permission'
|
|
5
|
-
import {
|
|
5
|
+
import { useHttpClient, usePermission } from '@/hooks'
|
|
6
6
|
import { useQueryTriggerStore } from '@/stores'
|
|
7
7
|
import { UsergroupAddOutlined } from '@ant-design/icons'
|
|
8
8
|
import type { TableColumnsType } from 'antd'
|
|
@@ -17,7 +17,7 @@ export const swrKey = {
|
|
|
17
17
|
const RoleList = () => {
|
|
18
18
|
const { accessible: viewable } = usePermission('200005')
|
|
19
19
|
const { modal, message } = App.useApp()
|
|
20
|
-
const
|
|
20
|
+
const httpClient = useHttpClient()
|
|
21
21
|
const create = useCreateRole()
|
|
22
22
|
const remove = useRemoveRole()
|
|
23
23
|
const update = useUpdateRole()
|
|
@@ -129,9 +129,7 @@ const RoleList = () => {
|
|
|
129
129
|
size="small"
|
|
130
130
|
type="link"
|
|
131
131
|
onClick={async () => {
|
|
132
|
-
const role = await
|
|
133
|
-
method: 'GET',
|
|
134
|
-
url: '/api/usystem/role/info',
|
|
132
|
+
const role = await httpClient.get<Role>('/api/usystem/role/info', {
|
|
135
133
|
params: { name: value.name },
|
|
136
134
|
})
|
|
137
135
|
showUpdateModal({
|
|
@@ -153,11 +151,13 @@ const RoleList = () => {
|
|
|
153
151
|
onClick={() => {
|
|
154
152
|
modal.confirm({
|
|
155
153
|
title: '删除角色',
|
|
156
|
-
content:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
154
|
+
content: (
|
|
155
|
+
<Highlight texts={[value.name]}>
|
|
156
|
+
确定要删除角色
|
|
157
|
+
{value.name}
|
|
158
|
+
吗?
|
|
159
|
+
</Highlight>
|
|
160
|
+
),
|
|
161
161
|
async onOk() {
|
|
162
162
|
await remove.trigger(
|
|
163
163
|
{
|
|
@@ -182,7 +182,7 @@ const RoleList = () => {
|
|
|
182
182
|
},
|
|
183
183
|
},
|
|
184
184
|
],
|
|
185
|
-
[trigger, viewable,
|
|
185
|
+
[trigger, viewable, httpClient, modal, message, remove, showUpdateModal],
|
|
186
186
|
)
|
|
187
187
|
|
|
188
188
|
return (
|
package/src/types/index.ts
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
import type { ItemType2 } from '@/layouts/NavBar'
|
|
2
|
-
|
|
3
|
-
export interface UserInfo {
|
|
4
|
-
authorityId: string
|
|
5
|
-
exp: number
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface LoaderData {
|
|
9
|
-
navs: ItemType2[] // 导航栏数据
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface BackendResponse<T> {
|
|
13
|
-
code: number
|
|
14
|
-
msg: string
|
|
15
|
-
data: T
|
|
16
|
-
}
|
|
17
|
-
|
|
18
1
|
export interface ListResponse<T> {
|
|
19
2
|
List: T[]
|
|
20
3
|
Page: number
|