Fixed API folder name

This commit is contained in:
Richárd Kunkli
2020-10-25 16:56:44 +01:00
parent c837f592d0
commit 853f05d63c
50 changed files with 1 additions and 1 deletions

View File

@ -0,0 +1,29 @@
import ServiceBase from '../../common/ServiceBase';
const login_url = 'api/auth/authenticate';
export default {
isAuthenticated() {
return sessionStorage.getItem('user') !== null;
},
login(username: string, password: string) {
let body = {
username: username,
password: password
};
let options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
};
return ServiceBase.makeRequest(login_url, options)
.then(response => {
sessionStorage.setItem('user', `${response.token_type} ${response.access_token}`);
return Promise.resolve();
});
}
}