web-base/admin/src/api.js

20 lines
536 B
JavaScript
Raw Normal View History

2020-06-14 12:38:35 +02:00
import 'babel-polyfill';
export default class API {
constructor() {
this.user = {};
this.baseUrl = "http://localhost"
}
async fetchUser() {
let response = await fetch(this.baseUrl + "/api/user/fetch");
let data = await response.json()
this.user = data["users"][0];
return data && data.success && data.hasOwnProperty("logoutIn");
}
async logout() {
let response = await fetch(this.baseUrl + "/api/user/logout");
return await response.json();
}
};