first commit
This commit is contained in:
16
src/api/auth/index.js
Normal file
16
src/api/auth/index.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { defAxios } from '@/utils/http'
|
||||
|
||||
export const login = (data) => {
|
||||
return defAxios({
|
||||
url: '/auth/login',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export const refreshToken = () => {
|
||||
return defAxios({
|
||||
url: '/auth/refreshToken',
|
||||
method: 'post',
|
||||
})
|
||||
}
|
38
src/api/user/index.js
Normal file
38
src/api/user/index.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import { defAxios, mockAxios } from '@/utils/http'
|
||||
|
||||
export function getUsers(data = {}) {
|
||||
return defAxios({
|
||||
url: '/users',
|
||||
method: 'get',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getUser(id) {
|
||||
if (id) {
|
||||
return defAxios({
|
||||
url: `/user/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
return defAxios({
|
||||
url: '/user',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function saveUser(data = {}, id) {
|
||||
if (id) {
|
||||
return defAxios({
|
||||
url: '/user',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
return defAxios({
|
||||
url: `/user/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user