24 lines
451 B
TypeScript
Raw Normal View History

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 请求 */
export const getFoo = (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 请求 */
export const postFoo = (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 },
})
}