Skip to content

Commit

Permalink
Merge pull request #102 from ThatConference/next/feature
Browse files Browse the repository at this point in the history
feature -> main
  • Loading branch information
theClarkSell committed Oct 12, 2023
2 parents 598445a + 60a0c9f commit 8af7cd0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thatconference.com",
"version": "5.0.10",
"version": "5.0.11",
"description": "THATConference.com website",
"main": "index.js",
"type": "module",
Expand Down
30 changes: 14 additions & 16 deletions src/lib/gfetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@ function init(fetch) {
// 'that-correlation-id': createCorrelationId()
};

const json = (r) => r.json();
const handleResult = (r) => {
if (browser) {
loading.set(false);
}

if (r.ok) {
return r.json();
} else {
throw new Error(`${r.status} ${r.statusText}`);
}
};

function updateHeaders(values) {
headers = {
Expand Down Expand Up @@ -55,11 +65,7 @@ function init(fetch) {
retries: 3,
retryOn
})
.then(json)
.then((r) => {
if (browser) loading.set(false);
return r;
})
.then(handleResult)
.catch((error) => {
console.error('api query error:', error);
Sentry.captureException(error);
Expand Down Expand Up @@ -87,11 +93,7 @@ function init(fetch) {
}),
retryOn
})
.then(json)
.then((r) => {
if (browser) loading.set(false);
return r;
})
.then(handleResult)
.catch((error) => {
console.error('api secure query error:', error);
Sentry.captureException(error);
Expand Down Expand Up @@ -119,11 +121,7 @@ function init(fetch) {
}),
retryOn
})
.then(json)
.then((r) => {
if (browser) loading.set(false);
return r;
})
.then(handleResult)
.catch((error) => {
console.error('api mutation error:', error);
Sentry.captureException(error);
Expand Down

1 comment on commit 8af7cd0

@vercel
Copy link

@vercel vercel bot commented on 8af7cd0 Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.