pyxis-page/src/api/admins.ts
2021-04-25 20:50:58 +08:00

67 lines
1.1 KiB
TypeScript

import request from '@/utils/request'
export interface IAdmin {
id: string
username: string
showname: string
comment: string
locked: boolean
roles: string[]
sex: string
avatar: string
password: string
department: string
}
export const defaultAdmin: IAdmin = {
id: '',
username: '',
showname: '',
comment: '',
locked: false,
roles: [],
sex: '0',
password: '',
avatar: '',
department: ''
}
export const getAdminInfo = (data: any) =>
request({
url: '/admin/info',
method: 'post',
data
})
export const login = (data: any) =>
request({
url: '/admin/login',
method: 'post',
data
})
export const logout = () =>
request({
url: '/admin/logout',
method: 'post'
})
export const saveAdmin = (data: any) =>
request({
url: '/admin/save',
method: 'post',
data
})
export const deleteAdmin = (uid: string) => {
return request({
url: `/admin/${uid}/delete`,
method: 'post'
})
}
export const getUsers = (params: any) =>
request({
url: '/admins',
method: 'get',
params
})