This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import ayconfig from "../utils/config";
|
||||
|
||||
export default {
|
||||
authenticate(login, password) {
|
||||
fetch(ayconfig.apiUrl + "/auth", {
|
||||
login: login,
|
||||
password: password
|
||||
})
|
||||
.then(function(response) {
|
||||
if (response.status != 200) {
|
||||
alert("Error: " + response.statusText);
|
||||
return;
|
||||
}
|
||||
// Handle response you get from the server
|
||||
response.json().then(function(data) {
|
||||
//set token in config here
|
||||
return data;
|
||||
});
|
||||
})
|
||||
.catch(function(err) {
|
||||
alert("Fetch Error :-S", err);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user