36 lines
994 B
TypeScript
36 lines
994 B
TypeScript
import api from './index'
|
|
|
|
// 程序分类相关API
|
|
export const programCategoryAPI = {
|
|
// 获取所有程序分类(需要认证)
|
|
getAllProgramCategories: () => {
|
|
return api.get('/api/program-categories')
|
|
},
|
|
|
|
// 获取所有程序分类(不需要认证的公共接口)
|
|
getAllProgramCategoriesPublic: () => {
|
|
return api.get('/api/program-categories/public')
|
|
},
|
|
|
|
// 根据ID获取程序分类
|
|
getProgramCategoryById: (id: number) => {
|
|
return api.get(`/api/program-categories/${id}`)
|
|
},
|
|
|
|
// 创建程序分类
|
|
createProgramCategory: (categoryData: any) => {
|
|
return api.post('/api/program-categories', categoryData)
|
|
},
|
|
|
|
// 更新程序分类
|
|
updateProgramCategory: (id: number, categoryData: any) => {
|
|
return api.put(`/api/program-categories/${id}`, categoryData)
|
|
},
|
|
|
|
// 删除程序分类
|
|
deleteProgramCategory: (id: number) => {
|
|
return api.delete(`/api/program-categories/${id}`)
|
|
}
|
|
}
|
|
|
|
export default programCategoryAPI |