feat: 统一函数命名

This commit is contained in:
2026-08-02 12:02:17 +08:00
parent 97235386ca
commit 99d5392a68
64 changed files with 331 additions and 1459 deletions

View File

@@ -1,22 +1,22 @@
import { http } from '@/lib'
import type { PageParams, Post, PostFormOutput } from '@/schemas'
export const getPosts = (params: PageParams) => {
return http.get<Post[], ApiPageResponse<Post>>('/post', { params })
export const listPosts = (params: PageParams) => {
return http.get<Post[], ApiPageResponse<Post>>('/posts', { params })
}
export const createPost = (data: PostFormOutput) => {
return http.post<{ post_id: number }>('/post', data)
return http.post<{ post_id: number }>('/posts', data)
}
export const updatePost = (id: number, data: PostFormOutput) => {
return http.patch(`/post/${id}`, data)
return http.patch(`/posts/${id}`, data)
}
export const getPost = (id: number) => {
return http.get<Post>(`/post/${id}`)
return http.get<Post>(`/posts/${id}`)
}
export const deletePost = (id: number) => {
return http.delete(`/post/${id}`)
return http.delete(`/posts/${id}`)
}