diff --git a/app/accept/[id]/accept-client.tsx b/app/accept/[id]/accept-client.tsx
index 9d26268..a154cc5 100644
--- a/app/accept/[id]/accept-client.tsx
+++ b/app/accept/[id]/accept-client.tsx
@@ -5,10 +5,30 @@ import { authClient } from "@/lib/auth-client";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
-export function AcceptClient({ id }: { id: string }) {
+export function AcceptClient({ id }: Readonly<{ id: string }>) {
const [busy, setBusy] = useState(false);
const [msg, setMsg] = useState("");
const { data: session, isPending } = authClient.useSession();
+
+ let action: React.ReactNode;
+ if (isPending) {
+ action = ;
+ } else if (session) {
+ action = (
+
+ );
+ } else {
+ action = (
+
+ );
+ }
+
return (
@@ -17,17 +37,7 @@ export function AcceptClient({ id }: { id: string }) {
Join workspace
- {isPending ? : !session ? (
-
- ) : (
-
- )}
+ {action}
{msg}
diff --git a/app/accept/[id]/page.tsx b/app/accept/[id]/page.tsx
index 4785a21..b4e3ea5 100644
--- a/app/accept/[id]/page.tsx
+++ b/app/accept/[id]/page.tsx
@@ -1,5 +1,5 @@
import { AcceptClient } from "./accept-client";
-export default async function Accept({ params }: { params: Promise<{ id: string }> }) {
+export default async function Accept({ params }: Readonly<{ params: Promise<{ id: string }> }>) {
const { id } = await params;
return ;
}
diff --git a/app/consent/consent-form.tsx b/app/consent/consent-form.tsx
index db186dc..4fb76ef 100644
--- a/app/consent/consent-form.tsx
+++ b/app/consent/consent-form.tsx
@@ -4,7 +4,7 @@ import { Loader2 } from "lucide-react";
import { Button } from "@/components/ui/button";
/** The signed authorization query must go back to the server byte-for-byte. */
-const oauthQuery = () => (typeof window === "undefined" ? "" : window.location.search.slice(1));
+const oauthQuery = () => (typeof globalThis.window === "undefined" ? "" : globalThis.location.search.slice(1));
export function ConsentForm() {
const [busy, setBusy] = useState<"accept" | "deny" | null>(null);
@@ -21,7 +21,7 @@ export function ConsentForm() {
});
const data = (await res.json()) as { url?: string; redirect?: boolean };
if (data?.url) {
- window.location.href = data.url;
+ globalThis.location.href = data.url;
return;
}
throw new Error("no redirect url");
@@ -49,7 +49,7 @@ export function ConsentForm() {
/** No session on the consent page means the flow lost its login; send it back. */
export function ContinueToLogin() {
return (
-