|
|
@@ -2,11 +2,11 @@ import React, { useState, useEffect } from 'react';
|
|
|
import { useQuery } from '@tanstack/react-query';
|
|
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@d8d/shared-ui-components/components/ui/select';
|
|
|
import { FormControl, FormDescription, FormItem, FormLabel, FormMessage } from '@d8d/shared-ui-components/components/ui/form';
|
|
|
-import { areaClient } from '../api/areaClient';
|
|
|
+import { areaClient, areaClientManager } from '../api/areaClient';
|
|
|
import type { InferResponseType } from 'hono/client';
|
|
|
|
|
|
// 类型定义
|
|
|
-type AreaResponse = InferResponseType<typeof areaClient.$get, 200>['data'][0];
|
|
|
+type AreaResponse = InferResponseType<typeof areaClient.index.$get, 200>['data'][0];
|
|
|
|
|
|
interface AreaSelectProps {
|
|
|
value?: {
|
|
|
@@ -39,7 +39,7 @@ export const AreaSelect: React.FC<AreaSelectProps> = ({
|
|
|
const { data: provinces, isLoading: isLoadingProvinces } = useQuery({
|
|
|
queryKey: ['areas', 'provinces'],
|
|
|
queryFn: async () => {
|
|
|
- const res = await areaClient.$get({
|
|
|
+ const res = await areaClientManager.get().index.$get({
|
|
|
query: {
|
|
|
page: 1,
|
|
|
pageSize: 100,
|
|
|
@@ -63,7 +63,7 @@ export const AreaSelect: React.FC<AreaSelectProps> = ({
|
|
|
queryKey: ['areas', 'cities', selectedProvince],
|
|
|
queryFn: async () => {
|
|
|
if (!selectedProvince) return { data: [] };
|
|
|
- const res = await areaClient.$get({
|
|
|
+ const res = await areaClientManager.get().index.$get({
|
|
|
query: {
|
|
|
page: 1,
|
|
|
pageSize: 100,
|
|
|
@@ -89,7 +89,7 @@ export const AreaSelect: React.FC<AreaSelectProps> = ({
|
|
|
queryKey: ['areas', 'districts', selectedCity],
|
|
|
queryFn: async () => {
|
|
|
if (!selectedCity) return { data: [] };
|
|
|
- const res = await areaClient.$get({
|
|
|
+ const res = await areaClientManager.get().index.$get({
|
|
|
query: {
|
|
|
page: 1,
|
|
|
pageSize: 100,
|