mirror of
https://github.com/SkalaraAI/skalara-core.git
synced 2025-04-09 23:20:15 -04:00
35 lines
880 B
TypeScript
35 lines
880 B
TypeScript
import { createServerComponentClient } from "@supabase/auth-helpers-nextjs";
|
|
import { Database } from "@/types/supabase";
|
|
import { cookies } from "next/headers";
|
|
import { redirect } from "next/navigation";
|
|
import prisma from "@/lib/prisma";
|
|
|
|
async function getSession(supabase: any) {
|
|
const {
|
|
data: { session },
|
|
} = await supabase.auth.getSession();
|
|
return session;
|
|
}
|
|
|
|
async function fetchFeatures(projectID: string) {
|
|
const supabase = createServerComponentClient<Database>({ cookies });
|
|
const session = await getSession(supabase);
|
|
|
|
if (!session) redirect("/auth");
|
|
|
|
try {
|
|
// TODO: fetch all features in this project
|
|
} catch (err) {
|
|
console.error(err);
|
|
}
|
|
}
|
|
|
|
export async function FeatureList({ projectID }: { projectID: string }) {
|
|
const features = await fetchFeatures(projectID);
|
|
return (
|
|
<div>
|
|
<h1>Feature List</h1>
|
|
</div>
|
|
);
|
|
}
|