-
Notifications
You must be signed in to change notification settings - Fork 37
feat: update GraphQL fragments and queries for bounty management #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
0xdevcollins
merged 8 commits into
boundlessfi:main
from
Ekene001:feat/Create-a-GraphQL-API-service-layer
Feb 23, 2026
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
565abbd
feat: update GraphQL fragments and queries for bounty management
Ekene001 163eaed
feat: enhance authentication flow and improve session validation
Ekene001 e6dd7c1
feat: improve session validation by normalizing response payload in f…
Ekene001 f86de9f
Merge branch 'main' of github.com:Ekene001/bounties into feat/Create-…
Ekene001 63df2b7
feat: update bounty query types and improve pagination handling in in…
Ekene001 961d51c
optimize optimistic update for bounty mutation by filtering undefined…
Ekene001 48607ca
Merge branch 'main' of github.com:Ekene001/bounties into feat/Create-…
Ekene001 101d72b
refactor: remove unused details key from bounty query keys
Ekene001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| "use client"; | ||
|
|
||
| import { useEffect, useState, Suspense } from "react"; | ||
| import { useRouter, useSearchParams } from "next/navigation"; | ||
| import { authClient } from "@/lib/auth-client"; | ||
| import { toast } from "sonner"; | ||
| import { Loader2, CheckCircle2, AlertCircle } from "lucide-react"; | ||
| import { | ||
| Card, | ||
| CardHeader, | ||
| CardTitle, | ||
| CardDescription, | ||
| CardFooter, | ||
| } from "@/components/ui/card"; | ||
| import { Button } from "@/components/ui/button"; | ||
| import Link from "next/link"; | ||
|
|
||
| function VerifyContent() { | ||
| const router = useRouter(); | ||
| const searchParams = useSearchParams(); | ||
| const defaultCallback = "/bounty"; | ||
| const [status, setStatus] = useState<"loading" | "success" | "error">( | ||
| "loading", | ||
| ); | ||
| const [error, setError] = useState<string | null>(null); | ||
|
|
||
| useEffect(() => { | ||
| const verifyToken = async () => { | ||
| const token = searchParams.get("token"); | ||
| const rawCallbackURL = searchParams.get("callbackURL") ?? defaultCallback; | ||
| const isSafeRelativeCallback = | ||
| rawCallbackURL.startsWith("/") && | ||
| !rawCallbackURL.startsWith("//") && | ||
| !rawCallbackURL.includes("\\") && | ||
| !/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(rawCallbackURL); | ||
| const validatedCallback = isSafeRelativeCallback | ||
| ? rawCallbackURL | ||
| : defaultCallback; | ||
|
|
||
| if (!token) { | ||
| setStatus("error"); | ||
| setError("Missing verification token."); | ||
| return; | ||
| } | ||
|
|
||
| try { | ||
| const { error } = await authClient.magicLink.verify({ | ||
| query: { | ||
| token, | ||
| callbackURL: validatedCallback, | ||
| }, | ||
| }); | ||
|
|
||
| if (error) { | ||
| setStatus("error"); | ||
| setError(error.message || "Failed to verify magic link."); | ||
| } else { | ||
| setStatus("success"); | ||
| toast.success("Successfully verified! Redirecting..."); | ||
| // Redirect is handled by Better Auth if successful, | ||
| // but we can also manually redirect if needed after a short delay | ||
| setTimeout(() => { | ||
| router.push(validatedCallback); | ||
| }, 2000); | ||
| } | ||
| } catch (err) { | ||
| setStatus("error"); | ||
| setError("An unexpected error occurred. Please try again."); | ||
| console.error(err); | ||
| } | ||
| }; | ||
|
|
||
| verifyToken(); | ||
| }, [searchParams, router]); | ||
|
|
||
| return ( | ||
| <div className="bg-muted flex min-h-svh flex-col items-center justify-center p-6 md:p-10"> | ||
| <Card className="w-full max-w-md"> | ||
| <CardHeader className="text-center"> | ||
| <div className="flex justify-center mb-4"> | ||
| {status === "loading" && ( | ||
| <Loader2 className="h-12 w-12 text-primary animate-spin" /> | ||
| )} | ||
| {status === "success" && ( | ||
| <CheckCircle2 className="h-12 w-12 text-green-500" /> | ||
| )} | ||
| {status === "error" && ( | ||
| <AlertCircle className="h-12 w-12 text-destructive" /> | ||
| )} | ||
| </div> | ||
| <CardTitle className="text-2xl font-bold"> | ||
| {status === "loading" && "Verifying your magic link"} | ||
| {status === "success" && "Verification successful"} | ||
| {status === "error" && "Verification failed"} | ||
| </CardTitle> | ||
| <CardDescription> | ||
| {status === "loading" && | ||
| "Please wait while we confirm your identity..."} | ||
| {status === "success" && | ||
| "You've been successfully signed in. Redirecting you now..."} | ||
| {status === "error" && | ||
| (error || "The magic link is invalid or has expired.")} | ||
| </CardDescription> | ||
| </CardHeader> | ||
| {status === "error" && ( | ||
| <CardFooter className="flex justify-center"> | ||
| <Button asChild> | ||
| <Link href="/auth">Back to Login</Link> | ||
| </Button> | ||
| </CardFooter> | ||
| )} | ||
| </Card> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default function MagicLinkVerifyPage() { | ||
| return ( | ||
| <Suspense | ||
| fallback={ | ||
| <div className="bg-muted flex min-h-svh flex-col items-center justify-center p-6 md:p-10"> | ||
| <Loader2 className="h-12 w-12 text-primary animate-spin" /> | ||
| </div> | ||
| } | ||
| > | ||
| <VerifyContent /> | ||
| </Suspense> | ||
| ); | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.