41 lines
791 B
TypeScript
41 lines
791 B
TypeScript
import useAxios from "axios-hooks";
|
|
import { Result } from "@/types/http";
|
|
|
|
export interface MockResult {
|
|
id: number;
|
|
}
|
|
|
|
export interface MockPage {
|
|
id: number;
|
|
}
|
|
|
|
/**
|
|
* fetch the data
|
|
* 详细使用可以查看 useAxios 的文档
|
|
*/
|
|
export const useGetDialog = () => {
|
|
const url = `/app-api/ai/dialog/getDialog`;
|
|
|
|
const [{ data, loading, error }, execute] = useAxios<Result<any>>(
|
|
{
|
|
url,
|
|
method: "GET",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
},
|
|
{ manual: true } // 手动触发
|
|
);
|
|
|
|
const getDialog = (params: { pageNo: number; pageSize: number }) => {
|
|
return execute({
|
|
params,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
});
|
|
};
|
|
|
|
return { data, loading, error, getDialog };
|
|
};
|