|
|
@@ -2,7 +2,7 @@ import React, { useState, useMemo, useCallback } from 'react';
|
|
|
import { useQuery } from '@tanstack/react-query';
|
|
|
import { format } from 'date-fns';
|
|
|
import { Plus, Search, Edit, Trash2, Filter, X } from 'lucide-react';
|
|
|
-import { userClient } from '../api/userClient';
|
|
|
+import { userClient, userClientManager } from '../api/userClient';
|
|
|
import type { InferRequestType, InferResponseType } from 'hono/client';
|
|
|
import { Button } from '@d8d/shared-ui-components/components/ui/button';
|
|
|
import { Input } from '@d8d/shared-ui-components/components/ui/input';
|
|
|
@@ -97,7 +97,7 @@ export const UserManagement = () => {
|
|
|
filterParams.createdAt = filters.createdAt;
|
|
|
}
|
|
|
|
|
|
- const res = await userClient.index.$get({
|
|
|
+ const res = await userClientManager.get().index.$get({
|
|
|
query: {
|
|
|
page: searchParams.page,
|
|
|
pageSize: searchParams.limit,
|
|
|
@@ -208,7 +208,7 @@ export const UserManagement = () => {
|
|
|
// 处理创建表单提交
|
|
|
const handleCreateSubmit = async (data: CreateUserFormData) => {
|
|
|
try {
|
|
|
- const res = await userClient.index.$post({
|
|
|
+ const res = await userClientManager.get().index.$post({
|
|
|
json: data
|
|
|
});
|
|
|
if (res.status !== 201) {
|
|
|
@@ -227,7 +227,7 @@ export const UserManagement = () => {
|
|
|
if (!editingUser) return;
|
|
|
|
|
|
try {
|
|
|
- const res = await userClient[':id']['$put']({
|
|
|
+ const res = await userClientManager.get()[':id']['$put']({
|
|
|
param: { id: editingUser.id },
|
|
|
json: data
|
|
|
});
|
|
|
@@ -252,7 +252,7 @@ export const UserManagement = () => {
|
|
|
if (!userToDelete) return;
|
|
|
|
|
|
try {
|
|
|
- const res = await userClient[':id']['$delete']({
|
|
|
+ const res = await userClientManager.get()[':id']['$delete']({
|
|
|
param: { id: userToDelete }
|
|
|
});
|
|
|
if (res.status !== 204) {
|