From 6119506bd349f09bf5908ed0e43bcd5f53e9065c Mon Sep 17 00:00:00 2001 From: WorkClub Automation Date: Mon, 9 Mar 2026 14:25:12 +0100 Subject: [PATCH] fix(frontend): remove invalid json parsing on shift signup - Backend `/signup` endpoint returns 200 OK with an empty body (`TypedResults.Ok()`), causing `res.json()` to throw 'Unexpected end of JSON input'. Removed the `res.json()` return. - Added Suspense boundary in login page to fix `useSearchParams` build error. --- frontend/src/app/login/page.tsx | 52 +++++++++++++++++++-------------- frontend/src/hooks/useShifts.ts | 1 - 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/frontend/src/app/login/page.tsx b/frontend/src/app/login/page.tsx index 2c91592..72ebb10 100644 --- a/frontend/src/app/login/page.tsx +++ b/frontend/src/app/login/page.tsx @@ -1,12 +1,12 @@ 'use client'; -import { useEffect } from 'react'; +import { useEffect, Suspense } from 'react'; import { signIn, signOut, useSession } from 'next-auth/react'; import { useRouter, useSearchParams } from 'next/navigation'; import { Card, CardHeader, CardTitle, CardContent, CardFooter } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; -export default function LoginPage() { +function LoginContent() { const { status } = useSession(); const router = useRouter(); const searchParams = useSearchParams(); @@ -29,28 +29,36 @@ export default function LoginPage() { }); }; + return ( + + + WorkClub Manager + + + + + + {hasError && ( + +

+ Having trouble? Try "Use different credentials" to clear your session. +

+
+ )} +
+ ); +} + +export default function LoginPage() { return (
- - - WorkClub Manager - - - - - - {hasError && ( - -

- Having trouble? Try "Use different credentials" to clear your session. -

-
- )} -
+ Loading...}> + +
); } diff --git a/frontend/src/hooks/useShifts.ts b/frontend/src/hooks/useShifts.ts index 45eb589..abf3199 100644 --- a/frontend/src/hooks/useShifts.ts +++ b/frontend/src/hooks/useShifts.ts @@ -111,7 +111,6 @@ export function useSignUpShift() { method: 'POST', }); if (!res.ok) throw new Error('Failed to sign up'); - return res.json(); }, onSuccess: () => { queryClient.invalidateQueries({ queryKey: ['shifts', activeClubId] });