diff --git a/src/app/(ui)/(volunteer)/checkin/page.tsx b/src/app/(ui)/(volunteer)/checkin/page.tsx index bb3a06f..b94a34c 100644 --- a/src/app/(ui)/(volunteer)/checkin/page.tsx +++ b/src/app/(ui)/(volunteer)/checkin/page.tsx @@ -10,18 +10,14 @@ export default function Checkin() { const userName = formData.get("Username"); try { - const response = await fetch("/api/checkin", { + await fetch("/api/checkin", { method: "POST", body: JSON.stringify({ - userName: userName + userName }) }); - if (response.ok) { - const result = await response.json(); - console.log(result); - } } catch (error) { - console.log(error); + // console.log(error); } } @@ -52,21 +48,17 @@ export default function Checkin() { {mockInfo.map( - ( - item: { - firstName: string; - lastName: string; - timeIn: string; - shift: string; - }, - idx - ) => ( + (item: { + firstName: string; + lastName: string; + timeIn: string; + shift: string; + }) => ( ) )} diff --git a/src/app/api/checkin/route.ts b/src/app/api/checkin/route.ts index e96cdda..c6de634 100644 --- a/src/app/api/checkin/route.ts +++ b/src/app/api/checkin/route.ts @@ -71,7 +71,7 @@ import { createClient } from "@supabase/supabase-js"; // } // } -export async function POST(req: Request) { +export default async function POST(req: Request) { const supabaseUrl = process.env.NEXT_APP_SUPABASE_URL; const key = process.env.SUPABASE_KEY; diff --git a/src/app/api/export/route.ts b/src/app/api/export/route.ts index b8c2459..175c644 100644 --- a/src/app/api/export/route.ts +++ b/src/app/api/export/route.ts @@ -44,13 +44,15 @@ export default async function GET() { // Return the CSV data return new NextResponse(csv, { + /* eslint-disable-next-line object-shorthand */ status: 200, + /* eslint-disable-next-line object-shorthand */ headers: headers }); // return NextResponse.json({ message: "Success"}, { status: 200}); } catch (error) { - console.error("Error:", error); + // console.error("Error:", error); return NextResponse.json( { message: "An unexpected error occurred" }, { status: 500 } diff --git a/src/app/api/people/route.ts b/src/app/api/people/route.ts index 9d2774e..dc6e2a1 100644 --- a/src/app/api/people/route.ts +++ b/src/app/api/people/route.ts @@ -11,7 +11,7 @@ export const GET = async () => { try { const supabase = createClient(supabaseUrl, key); const { data, error } = await supabase.from("users").select("name"); - console.log(data); + // console.log(data); if (error) { return NextResponse.json({ message: error }); } diff --git a/src/app/api/shifts/route.ts b/src/app/api/shifts/route.ts index d921945..d5744f0 100644 --- a/src/app/api/shifts/route.ts +++ b/src/app/api/shifts/route.ts @@ -11,7 +11,7 @@ export const GET = async () => { try { const supabase = createClient(supabaseUrl, key); const { data, error } = await supabase.from("shifts").select("id"); - console.log(data); + // console.log(data); if (error) { return NextResponse.json({ message: error }); } @@ -27,16 +27,16 @@ export const POST = async (request: NextRequest) => { const key = process.env.SUPABASE_KEY as string; try { - const req_body = await request.json(); + const reqBody = await request.json(); - if (!req_body) { + if (!reqBody) { return NextResponse.json({ - message: "Please provided a req_body" + message: "Please provided a reqBody" }); } const supabase = createClient(supabaseUrl, key); - const { data, error } = await supabase.from("shifts").upsert(req_body); + const { data, error } = await supabase.from("shifts").upsert(reqBody); if (error || !data) { return NextResponse.json({ message: error });