Gracefully handle missing gallery_videos table before migration
This commit is contained in:
@@ -117,11 +117,12 @@ export async function loadGallery(userId?: string | null): Promise<{
|
||||
}
|
||||
|
||||
const supabase = createClient();
|
||||
const [{ data: albums }, { data: photos }, { data: videos }] = await Promise.all([
|
||||
const [{ data: albums }, { data: photos }, videoResult] = await Promise.all([
|
||||
supabase.from("gallery_albums").select("*").eq("user_id", userId).order("sort_order"),
|
||||
supabase.from("gallery_photos").select("*").eq("user_id", userId).order("sort_order"),
|
||||
supabase.from("gallery_videos").select("*").eq("user_id", userId).order("sort_order"),
|
||||
]);
|
||||
const videos = videoResult.error ? [] : videoResult.data;
|
||||
|
||||
return {
|
||||
albums: (albums as GalleryAlbum[])?.length
|
||||
|
||||
Reference in New Issue
Block a user