try promises

This commit is contained in:
Arthur Lu 2022-12-12 15:56:57 -08:00
parent 942b9427ea
commit 0553c3056b

View File

@ -8,6 +8,15 @@ export async function requestTicket (username, password) {
"Content-Type": "application/x-www-form-urlencoded"
},
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();
return data;