fix(backend): resolve shift signup by looking up Member via ExternalUserId #3
@@ -1,12 +1,12 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useEffect } from 'react';
|
import { useEffect, Suspense } from 'react';
|
||||||
import { signIn, signOut, useSession } from 'next-auth/react';
|
import { signIn, signOut, useSession } from 'next-auth/react';
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
import { Card, CardHeader, CardTitle, CardContent, CardFooter } from '@/components/ui/card';
|
import { Card, CardHeader, CardTitle, CardContent, CardFooter } from '@/components/ui/card';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
|
||||||
export default function LoginPage() {
|
function LoginContent() {
|
||||||
const { status } = useSession();
|
const { status } = useSession();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
@@ -29,28 +29,36 @@ export default function LoginPage() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card className="w-96">
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle className="text-2xl text-center">WorkClub Manager</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent className="space-y-3">
|
||||||
|
<Button onClick={handleSignIn} className="w-full">
|
||||||
|
Sign in with Keycloak
|
||||||
|
</Button>
|
||||||
|
<Button variant="outline" onClick={handleSwitchAccount} className="w-full">
|
||||||
|
Use different credentials
|
||||||
|
</Button>
|
||||||
|
</CardContent>
|
||||||
|
{hasError && (
|
||||||
|
<CardFooter>
|
||||||
|
<p className="text-sm text-muted-foreground text-center w-full">
|
||||||
|
Having trouble? Try "Use different credentials" to clear your session.
|
||||||
|
</p>
|
||||||
|
</CardFooter>
|
||||||
|
)}
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function LoginPage() {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-center min-h-screen bg-gray-50">
|
<div className="flex items-center justify-center min-h-screen bg-gray-50">
|
||||||
<Card className="w-96">
|
<Suspense fallback={<Card className="w-96 p-6 text-center">Loading...</Card>}>
|
||||||
<CardHeader>
|
<LoginContent />
|
||||||
<CardTitle className="text-2xl text-center">WorkClub Manager</CardTitle>
|
</Suspense>
|
||||||
</CardHeader>
|
|
||||||
<CardContent className="space-y-3">
|
|
||||||
<Button onClick={handleSignIn} className="w-full">
|
|
||||||
Sign in with Keycloak
|
|
||||||
</Button>
|
|
||||||
<Button variant="outline" onClick={handleSwitchAccount} className="w-full">
|
|
||||||
Use different credentials
|
|
||||||
</Button>
|
|
||||||
</CardContent>
|
|
||||||
{hasError && (
|
|
||||||
<CardFooter>
|
|
||||||
<p className="text-sm text-muted-foreground text-center w-full">
|
|
||||||
Having trouble? Try "Use different credentials" to clear your session.
|
|
||||||
</p>
|
|
||||||
</CardFooter>
|
|
||||||
)}
|
|
||||||
</Card>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,6 @@ export function useSignUpShift() {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
});
|
});
|
||||||
if (!res.ok) throw new Error('Failed to sign up');
|
if (!res.ok) throw new Error('Failed to sign up');
|
||||||
return res.json();
|
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries({ queryKey: ['shifts', activeClubId] });
|
queryClient.invalidateQueries({ queryKey: ['shifts', activeClubId] });
|
||||||
|
|||||||
Reference in New Issue
Block a user