Commit 5a028cd7 authored by Sylvain Kerkour's avatar Sylvain Kerkour

js: throw error on non 200 response

parent 75e5ba55
Pipeline #147397391 passed with stages
in 59 seconds
......@@ -69,7 +69,13 @@ function graphqlReq(query, variables) {
method : 'POST',
};
return fetch(window.apiBaseUrl+'/graphql', data)
.then(function(res) { return res.json() });
.then(function(res) {
if (res.status !== 200) {
throw new Error();
}
return res.json()
});
}
function subscribeToNewsletter(email) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment