|
@@ -14,7 +14,7 @@ import {
|
|
|
EyeOff
|
|
EyeOff
|
|
|
} from 'lucide-react';
|
|
} from 'lucide-react';
|
|
|
|
|
|
|
|
-import { supplierClient } from '../api/supplierClient';
|
|
|
|
|
|
|
+import { supplierClient , supplierClientManager} from '../api/supplierClient';
|
|
|
import type { InferRequestType, InferResponseType } from 'hono/client';
|
|
import type { InferRequestType, InferResponseType } from 'hono/client';
|
|
|
import { CreateAdminSupplierDto, UpdateAdminSupplierDto } from '@d8d/supplier-module-mt/schemas';
|
|
import { CreateAdminSupplierDto, UpdateAdminSupplierDto } from '@d8d/supplier-module-mt/schemas';
|
|
|
|
|
|
|
@@ -74,7 +74,7 @@ export const SupplierManagement = () => {
|
|
|
const { data, isLoading, refetch } = useQuery({
|
|
const { data, isLoading, refetch } = useQuery({
|
|
|
queryKey: ['suppliers', searchParams],
|
|
queryKey: ['suppliers', searchParams],
|
|
|
queryFn: async () => {
|
|
queryFn: async () => {
|
|
|
- const res = await supplierClient.index.$get({
|
|
|
|
|
|
|
+ const res = await supplierClientManager.get().index.$get({
|
|
|
query: {
|
|
query: {
|
|
|
page: searchParams.page,
|
|
page: searchParams.page,
|
|
|
pageSize: searchParams.limit,
|
|
pageSize: searchParams.limit,
|
|
@@ -131,7 +131,7 @@ export const SupplierManagement = () => {
|
|
|
if (!supplierToDelete) return;
|
|
if (!supplierToDelete) return;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- const res = await supplierClient[':id']['$delete']({
|
|
|
|
|
|
|
+ const res = await supplierClientManager.get()[':id']['$delete']({
|
|
|
param: { id: Number(supplierToDelete) },
|
|
param: { id: Number(supplierToDelete) },
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -151,7 +151,7 @@ export const SupplierManagement = () => {
|
|
|
// 表单提交处理
|
|
// 表单提交处理
|
|
|
const handleCreateSubmit = async (data: CreateRequest) => {
|
|
const handleCreateSubmit = async (data: CreateRequest) => {
|
|
|
try {
|
|
try {
|
|
|
- const res = await supplierClient.index.$post({ json: data });
|
|
|
|
|
|
|
+ const res = await supplierClientManager.get().index.$post({ json: data });
|
|
|
if (res.status === 201) {
|
|
if (res.status === 201) {
|
|
|
toast.success('创建成功');
|
|
toast.success('创建成功');
|
|
|
setIsModalOpen(false);
|
|
setIsModalOpen(false);
|
|
@@ -175,7 +175,7 @@ export const SupplierManagement = () => {
|
|
|
...(data.password === '' && { password: undefined }),
|
|
...(data.password === '' && { password: undefined }),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const res = await supplierClient[':id']['$put']({
|
|
|
|
|
|
|
+ const res = await supplierClientManager.get()[':id']['$put']({
|
|
|
param: { id: Number(editingSupplier.id) },
|
|
param: { id: Number(editingSupplier.id) },
|
|
|
json: updateData,
|
|
json: updateData,
|
|
|
});
|
|
});
|