|
@@ -1,4 +1,4 @@
|
|
|
-import { http, httpGet } from '@/utils/http'
|
|
|
|
|
|
|
+import { http } from '@/utils/http'
|
|
|
export interface IFooItem {
|
|
export interface IFooItem {
|
|
|
id: string
|
|
id: string
|
|
|
name: string
|
|
name: string
|
|
@@ -15,7 +15,7 @@ export const getFooAPI = (name: string) => {
|
|
|
|
|
|
|
|
/** GET 请求 - 再次简化,看大家是否喜欢这种简化 */
|
|
/** GET 请求 - 再次简化,看大家是否喜欢这种简化 */
|
|
|
export const getFooAPI2 = (name: string) => {
|
|
export const getFooAPI2 = (name: string) => {
|
|
|
- return httpGet<IFooItem>('/foo', { name })
|
|
|
|
|
|
|
+ return http.get<IFooItem>('/foo', { name })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** POST 请求 */
|
|
/** POST 请求 */
|
|
@@ -27,3 +27,7 @@ export const postFooAPI = (name: string) => {
|
|
|
data: { name },
|
|
data: { name },
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+/** POST 请求 - 再次简化,看大家是否喜欢这种简化 */
|
|
|
|
|
+export const postFooAPI2 = (name: string) => {
|
|
|
|
|
+ return http.post<IFooItem>('/foo', { name }, { name })
|
|
|
|
|
+}
|