2024-02-01 15:21:36 +08:00
|
|
|
import { http } from '@/utils/http'
|
2024-02-01 15:35:41 +08:00
|
|
|
import type { IFooItem } from './foo.d'
|
2024-02-01 15:21:36 +08:00
|
|
|
|
2024-02-01 15:35:41 +08:00
|
|
|
export { IFooItem }
|
2024-02-01 15:21:36 +08:00
|
|
|
|
|
|
|
/** get 请求 */
|
2024-02-01 15:38:11 +08:00
|
|
|
export const getFooAPI = (name: string) => {
|
2024-02-01 15:35:41 +08:00
|
|
|
return http<IFooItem>({
|
2024-02-01 15:21:36 +08:00
|
|
|
url: `/foo`,
|
|
|
|
method: 'GET',
|
|
|
|
query: { name },
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
/** get 请求 */
|
2024-02-01 15:38:11 +08:00
|
|
|
export const postFooAPI = (name: string) => {
|
2024-02-01 15:35:41 +08:00
|
|
|
return http<IFooItem>({
|
2024-02-01 15:21:36 +08:00
|
|
|
url: `/foo`,
|
|
|
|
method: 'POST',
|
|
|
|
query: { name }, // post 请求也支持 query
|
|
|
|
data: { name },
|
|
|
|
})
|
|
|
|
}
|