Skip to content

Commit

Permalink
Wait to send requests until logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
andchiind committed Oct 19, 2023
1 parent a3e9e87 commit fcb4b03
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions frontend/src/components/Contexts/MissionListsContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ export const useMissions = (refreshInterval: number): MissionsResult => {
})
setMissionQueue(queue)
}

fetchAndUpdateMissions()
if (BackendAPICaller.accessToken) fetchAndUpdateMissions()

const id = setInterval(fetchAndUpdateMissions, refreshInterval)

return () => clearInterval(id)
}, [refreshInterval])
}, [refreshInterval, BackendAPICaller.accessToken])

return { ongoingMissions, missionQueue }
}
Expand Down

0 comments on commit fcb4b03

Please sign in to comment.