refactor: 请求等页面

This commit is contained in:
菲鸽
2024-05-15 10:06:51 +08:00
parent 2b41626a96
commit 5bdb29994d
13 changed files with 79 additions and 385 deletions

View File

@@ -6,28 +6,10 @@ export interface IFooItem {
/** GET 请求 */
export const getFooAPI = (name: string) => {
return http<IFooItem>({
url: `/foo`,
method: 'GET',
query: { name },
})
}
/** GET 请求 - 再次简化,看大家是否喜欢这种简化 */
export const getFooAPI2 = (name: string) => {
return http.get<IFooItem>('/foo', { name })
}
/** POST 请求 */
export const postFooAPI = (name: string) => {
return http<IFooItem>({
url: `/foo`,
method: 'POST',
query: { name }, // post 请求也支持 query
data: { name },
})
}
/** POST 请求 - 再次简化,看大家是否喜欢这种简化 */
export const postFooAPI2 = (name: string) => {
return http.post<IFooItem>('/foo', { name }, { name })
}