From 00d4bc594650ed9008b4af569cfe1c63bc642b78 Mon Sep 17 00:00:00 2001 From: Malted Date: Wed, 22 Jan 2025 13:40:10 -0500 Subject: [PATCH] handle case where no tavern selected on backend --- src/app/utils/tavern.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/utils/tavern.ts b/src/app/utils/tavern.ts index a6e4f9eb..cb661496 100644 --- a/src/app/utils/tavern.ts +++ b/src/app/utils/tavern.ts @@ -63,7 +63,9 @@ export const submitMyTavernLocation = async (tavernId: string) => { }) } -export const getMyTavernLocation: Promise = async () => { +export const getMyTavernLocation: Promise< + TavernEventItem | null +> = async () => { // check auth const session = await getSession() if (!session) { @@ -83,6 +85,8 @@ export const getMyTavernLocation: Promise = async () => { .firstPage() .then((r) => r[0]) + if (!foundTavern) return null + return { id: foundTavern.id, city: foundTavern.get('city'),