parent
30c963a5f0
commit
61a1c93f0f
89 changed files with 15859 additions and 2 deletions
29
client/libs/api_auth.js
Normal file
29
client/libs/api_auth.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
import axios from "axios";
|
||||
import { config } from "../config";
|
||||
import { makePostBody } from "./utils";
|
||||
|
||||
export function login(serverAddr, adminId, adminPwd, axiosConfig) {
|
||||
return axios
|
||||
.post(
|
||||
`${serverAddr}/login`,
|
||||
makePostBody(
|
||||
{
|
||||
act: "login",
|
||||
adminid: adminId,
|
||||
adminpwd: adminPwd
|
||||
},
|
||||
axiosConfig
|
||||
)
|
||||
)
|
||||
.then(response => {
|
||||
return response.data.Code === 200;
|
||||
});
|
||||
}
|
||||
|
||||
export function logout(serverAddr, axiosConfig) {
|
||||
return axios
|
||||
.post(`${serverAddr}/login`, makePostBody({ act: "logout" }), axiosConfig)
|
||||
.then(response => {
|
||||
return response.data.Code === 200;
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue