feat: 添加三个 service 文件和 RoleGuard 组件

This commit is contained in:
simonkoson
2026-05-21 19:46:40 +08:00
parent 7cc0bf21ff
commit b7560a6cf6
6 changed files with 455 additions and 1 deletions
+3 -1
View File
@@ -13,4 +13,6 @@ export async function logout() {
export async function me() {
const response = await http.get('/auth/me')
return response.data
}
}
export default { login, logout, me }
+21
View File
@@ -0,0 +1,21 @@
import http from './http'
export async function listEpisodes(limit = 50, offset = 0) {
const response = await http.get('/episodes', { params: { limit, offset } })
return response.data
}
export async function createEpisode(data) {
const response = await http.post('/episodes', data)
return response.data
}
export async function updateEpisode(id, data) {
const response = await http.patch(`/episodes/${id}`, data)
return response.data
}
export async function deleteEpisode(id) {
const response = await http.delete(`/episodes/${id}`)
return response.data
}
+21
View File
@@ -0,0 +1,21 @@
import http from './http'
export async function listUsers() {
const response = await http.get('/users')
return response.data
}
export async function createUser(data) {
const response = await http.post('/users', data)
return response.data
}
export async function updateUser(id, data) {
const response = await http.patch(`/users/${id}`, data)
return response.data
}
export async function deactivateUser(id) {
const response = await http.delete(`/users/${id}`)
return response.data
}
@@ -0,0 +1,21 @@
import http from './http'
export async function listTargets() {
const response = await http.get('/yearly_targets')
return response.data
}
export async function createTarget(data) {
const response = await http.post('/yearly_targets', data)
return response.data
}
export async function updateTarget(id, data) {
const response = await http.patch(`/yearly_targets/${id}`, data)
return response.data
}
export async function deleteTarget(id) {
const response = await http.delete(`/yearly_targets/${id}`)
return response.data
}