You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
958 B
35 lines
958 B
|
6 years ago
|
import request from "@/api/request"
|
||
|
6 years ago
|
import {isEmpty} from "@/util"
|
||
|
6 years ago
|
|
||
|
6 years ago
|
export const baseUrl = '/account'
|
||
|
6 years ago
|
|
||
|
6 years ago
|
export function login(data) {
|
||
|
6 years ago
|
return request.post(`${baseUrl}/login`, data).then(({data}) => data.data)
|
||
|
6 years ago
|
}
|
||
|
|
|
||
|
|
export function logout() {
|
||
|
6 years ago
|
return request.get(`${baseUrl}/logout`)
|
||
|
6 years ago
|
}
|
||
|
|
|
||
|
|
export function register(data) {
|
||
|
6 years ago
|
return request.post(`${baseUrl}/register`, data)
|
||
|
|
}
|
||
|
|
|
||
|
|
export function updateUserPwd(data) {
|
||
|
|
return request.post(`${baseUrl}/updatePwd`, data).then(({data}) => data)
|
||
|
|
}
|
||
|
|
|
||
|
|
export function updateAvatar(key) {
|
||
|
|
return request.get(`${baseUrl}/updateAvatar?key=${encodeURIComponent(key)}`).then(({data}) => ({...data, key}))
|
||
|
|
}
|
||
|
|
|
||
|
|
export function validate(pwd) {
|
||
|
|
return request.get(`${baseUrl}/validate?pwd=${pwd}`).then(({data}) => data)
|
||
|
|
}
|
||
|
|
|
||
|
6 years ago
|
export function checkName(name, id) {
|
||
|
6 years ago
|
let param = `?name=${name}`
|
||
|
|
if (!isEmpty(id)) param += `&id=${id}`
|
||
|
|
return request.get(`${baseUrl}/checkName${param}`).then(({data}) => data)
|
||
|
6 years ago
|
}
|