feat: init

This commit is contained in:
2025-09-04 11:29:00 +08:00
parent 2c9059ce2f
commit ddbee614e8
89 changed files with 3476 additions and 349 deletions

View File

@@ -0,0 +1,37 @@
import useAxios from 'axios-hooks';
import {Page, Result} from "@/types/http";
export interface MockResult {
id: number;
}
export interface MockPage {
id: number;
}
/**
* fetch the data
* 详细使用可以查看 useAxios 的文档
*/
export const useFetchXXX = () => {
// set the url
const url = `/xxx/xxx`;
// fetch the data
const [{data, loading, error}, refetch] = useAxios<Result<MockResult>>(url);
// to do something
return {data, loading, error, refetch};
}
/**
* fetch the data with page
* 详细使用可以查看 useAxios 的文档
*/
export const useFetchPageXXX = (page: number, size: number) => {
// set the url
const url = `/xxx/xxx?page=${page}&size=${size}`;
// fetch the data
const [{data, loading, error}, refetch] = useAxios<Page<MockResult>>(url);
// to do something
return {data, loading, error, refetch};
}