feat: translate
This commit is contained in:
39
projects/translate-h5/src/api/getDialog.ts
Normal file
39
projects/translate-h5/src/api/getDialog.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
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 = () => {
|
||||
return execute({
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return { data, loading, error, getDialog };
|
||||
};
|
||||
Reference in New Issue
Block a user