({
searchParams,
}: {
searchParams?: Promise<{ [key: string]: string | string[] | undefined }>
})
| 14 | |
| 15 | // Server component that handles the auth code expiration check |
| 16 | export default async function LoginPage({ |
| 17 | searchParams, |
| 18 | }: { |
| 19 | searchParams?: Promise<{ [key: string]: string | string[] | undefined }> |
| 20 | }) { |
| 21 | const resolvedSearchParams = searchParams ? await searchParams : {} |
| 22 | const authCode = resolvedSearchParams?.auth_code as string | undefined |
| 23 | |
| 24 | if (authCode) { |
| 25 | const { expiresAt } = parseAuthCode(authCode) |
| 26 | |
| 27 | // Check for token expiration on the server side |
| 28 | if (expiresAt && isAuthCodeExpired(expiresAt)) { |
| 29 | return ( |
| 30 | <Card> |
| 31 | <CardHeader> |
| 32 | <CardTitle>Uh-oh, spaghettio!</CardTitle> |
| 33 | <CardDescription>Auth code expired.</CardDescription> |
| 34 | </CardHeader> |
| 35 | <CardContent> |
| 36 | <p> |
| 37 | Please try starting Codebuff in your terminal again. If the |
| 38 | problem persists, reach out to {env.NEXT_PUBLIC_SUPPORT_EMAIL}. |
| 39 | </p> |
| 40 | </CardContent> |
| 41 | </Card> |
| 42 | ) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | return <LoginCard authCode={authCode} /> |
| 47 | } |
nothing calls this directly
no test coverage detected