Skip to content

Commit

Permalink
Merge pull request #1123 from hackclub/malted/rsvp-specifics-2
Browse files Browse the repository at this point in the history
handle case where no tavern selected on backend
  • Loading branch information
malted authored Jan 22, 2025
2 parents 7f29e11 + 00d4bc5 commit c646b28
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/utils/tavern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export const submitMyTavernLocation = async (tavernId: string) => {
})
}

export const getMyTavernLocation: Promise<TavernEventItem> = async () => {
export const getMyTavernLocation: Promise<
TavernEventItem | null
> = async () => {
// check auth
const session = await getSession()
if (!session) {
Expand All @@ -83,6 +85,8 @@ export const getMyTavernLocation: Promise<TavernEventItem> = async () => {
.firstPage()
.then((r) => r[0])

if (!foundTavern) return null

return {
id: foundTavern.id,
city: foundTavern.get('city'),
Expand Down

0 comments on commit c646b28

Please sign in to comment.