feat: walking skeleton - study space uploads
This commit is contained in:
18
src/routes/+page.server.ts
Normal file
18
src/routes/+page.server.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { createClient } from "@supabase/supabase-js";
|
||||
import { PUBLIC_SUPABASE_ANON_KEY, PUBLIC_SUPABASE_URL } from "$env/static/public";
|
||||
import type { PageServerLoad } from "./$types";
|
||||
import type { Database } from "$lib/database";
|
||||
import { error } from "@sveltejs/kit";
|
||||
|
||||
export const load: PageServerLoad = async ({ depends }) => {
|
||||
depends("db:study_spaces");
|
||||
const supabase = createClient<Database>(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY);
|
||||
const { data: studySpaces, error: err } = await supabase
|
||||
.from("study_spaces")
|
||||
.select("*, study_space_images(*)");
|
||||
if (err) error(500, "Failed to load study spaces");
|
||||
|
||||
return {
|
||||
studySpaces
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user