feat: add user role field (#49)

* feat: add user role field

* chore: fix typo

* feat: update signup api
This commit is contained in:
STEVEN
2022-05-15 10:57:54 +08:00
committed by GitHub
parent 64374610ea
commit f1cca0f298
20 changed files with 264 additions and 294 deletions

View File

@ -39,6 +39,13 @@ async function request<T>(config: RequestConfig): Promise<T> {
}
namespace api {
export function getSystemStatus() {
return request<API.SystemStatus>({
method: "GET",
url: "/api/status",
});
}
export function getUserInfo() {
return request<Model.User>({
method: "GET",
@ -46,22 +53,24 @@ namespace api {
});
}
export function login(name: string, password: string) {
export function login(email: string, password: string) {
return request<Model.User>({
method: "POST",
url: "/api/auth/login",
data: {
name,
email,
password,
},
});
}
export function signup(name: string, password: string) {
export function signup(email: string, role: UserRole, name: string, password: string) {
return request<Model.User>({
method: "POST",
url: "/api/auth/signup",
data: {
email,
role,
name,
password,
},