refactor: 请求等页面
This commit is contained in:
@@ -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 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user