Skip to content

Commit

Permalink
Added timeout for fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
robmoffat committed Jan 23, 2025
1 parent 477b5c1 commit 341fc09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/api/signup-submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { google } from 'googleapis';
import { readFileSync } from 'fs';

async function updateAttendees(api, calendarId, eventId, newAttendees) {
console.log(`Adding attendees to `, eventId, newAttendees)
console.log(`Adding attendees to `, eventId, newAttendees, new Date().toISOString)

await api.events.patch({
calendarId: calendarId,
Expand All @@ -13,6 +13,7 @@ async function updateAttendees(api, calendarId, eventId, newAttendees) {
sendUpdates: 'externalOnly'
})

console.log(`Attendees added to `, eventId, new Date().toISOString)
}

async function addAttendeeToEvent(api, calendarId, event, email, addForReal) {
Expand Down
5 changes: 3 additions & 2 deletions src/pages/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default function App({ location }) {
headers: {
"content-type": `application/json`,
},
signal: AbortSignal.timeout(50000)
})
.then(res => res.json())
.then(body => {
Expand All @@ -30,7 +31,7 @@ export default function App({ location }) {

const params = new URLSearchParams(location.search)

if (isSubmitted == 'spinner') {
if (isSubmitted === 'spinner') {
return (
<div className="signup form-container">
<h2>Please wait</h2>
Expand All @@ -39,7 +40,7 @@ export default function App({ location }) {
)

} else if (isSubmitted) {
if (isSubmitted == 'success') {
if (isSubmitted === 'success') {
return (
<div className="signup form-container">
<h2>Thank you for signing up!</h2>
Expand Down

0 comments on commit 341fc09

Please sign in to comment.