This commit is contained in:
2019-01-03 18:25:41 +00:00
parent 1e6eb7ca1a
commit a890bdeeb6
68 changed files with 35812 additions and 0 deletions

28
ayanova/src/api/auth.js Normal file
View File

@@ -0,0 +1,28 @@
/* Xeslint-disable */
import apiUtil from "./apiutil";
import { processLogin, processLogout } from "../utils/authutil";
export default {
async authenticate(login, password) {
return fetch(
apiUtil.APIUrl("auth"),
apiUtil.fetchPostNoAuthOptions({
login: login,
password: password
})
)
.then(apiUtil.status)
.then(apiUtil.json)
.then(processLogin)
.then(() => {
return Promise.resolve(true);
}) //succeeded, nothing to return
.catch(function(error) {
processLogout();
return Promise.reject(error);
});
},
logout() {
processLogout();
}
};