try promises
This commit is contained in:
parent
90ef6bca81
commit
54d27d5ccd
9
utils.js
9
utils.js
@ -8,6 +8,15 @@ export async function requestTicket (username, password) {
|
|||||||
"Content-Type": "application/x-www-form-urlencoded"
|
"Content-Type": "application/x-www-form-urlencoded"
|
||||||
},
|
},
|
||||||
body: prms.toString()
|
body: prms.toString()
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Network response was not OK');
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('There has been a problem with your fetch operation:', error);
|
||||||
});
|
});
|
||||||
let data = await response.json();
|
let data = await response.json();
|
||||||
return data;
|
return data;
|
||||||
|
Loading…
Reference in New Issue
Block a user