Changed api response "result" to "data"
This commit is contained in:
@@ -15,36 +15,7 @@ function json(response) {
|
||||
}
|
||||
|
||||
export default {
|
||||
authenticate(login, password, cb) {
|
||||
fetch(ayconfig.apiUrl + "auth", {
|
||||
method: "post",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
Accept: "application/json, text/plain, */*",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
login: login,
|
||||
password: password
|
||||
})
|
||||
})
|
||||
.then(status)
|
||||
.then(json)
|
||||
.then(function(data) {
|
||||
console.log(
|
||||
"AUTH.JS::authenticate() -> Request succeeded with JSON response",
|
||||
data
|
||||
);
|
||||
cb(data);
|
||||
//return data;
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.log("Request failed", error);
|
||||
cb(error); //sb cb(data,error or something)
|
||||
//return error;
|
||||
});
|
||||
},
|
||||
async authenticatepromise(login, password) {
|
||||
async authenticate(login, password) {
|
||||
return fetch(ayconfig.apiUrl + "auth", {
|
||||
method: "post",
|
||||
mode: "cors",
|
||||
@@ -60,14 +31,14 @@ export default {
|
||||
.then(status)
|
||||
.then(json)
|
||||
.then(function(data) {
|
||||
console.log(
|
||||
"AUTH.JS::authenticatepromise() -> Request succeeded with JSON response",
|
||||
data
|
||||
);
|
||||
// console.log(
|
||||
// "AUTH.JS::authenticatepromise() -> Request succeeded with JSON response",
|
||||
// data
|
||||
// );
|
||||
return data;
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.log("AUTH.JS::authenticatepromise() -> Request failed", error);
|
||||
// console.log("AUTH.JS::authenticatepromise() -> Request failed", error);
|
||||
//return error;
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user