chore: fix demo dep issue

This commit is contained in:
Bereket Engida
2024-10-12 02:25:40 +03:00
parent 90614d42e3
commit ec0fed68dd
3 changed files with 6 additions and 10 deletions

View File

@@ -11,19 +11,16 @@ import {
} from "@/components/ui/card"; } from "@/components/ui/card";
import { CheckIcon, XIcon } from "lucide-react"; import { CheckIcon, XIcon } from "lucide-react";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useRouter } from "next/navigation"; import { useParams, useRouter } from "next/navigation";
import { Skeleton } from "@/components/ui/skeleton"; import { Skeleton } from "@/components/ui/skeleton";
import { client, organization } from "@/lib/auth-client"; import { client, organization } from "@/lib/auth-client";
import { InvitationError } from "./invitation-error"; import { InvitationError } from "./invitation-error";
import { Invitation } from "@/lib/auth-types"; import { Invitation } from "@/lib/auth-types";
export default function InvitationPage({ export default function InvitationPage() {
params, const params = useParams<{
}: {
params: {
id: string; id: string;
}; }>();
}) {
const router = useRouter(); const router = useRouter();
const [invitationStatus, setInvitationStatus] = useState< const [invitationStatus, setInvitationStatus] = useState<
"pending" | "accepted" | "rejected" "pending" | "accepted" | "rejected"

View File

@@ -1,5 +1,4 @@
import { SignInButton, SignInFallback } from "@/components/sign-in-btn"; import { SignInButton, SignInFallback } from "@/components/sign-in-btn";
import { headers } from "next/headers";
import { Suspense } from "react"; import { Suspense } from "react";
export default async function Home() { export default async function Home() {

View File

@@ -49,9 +49,9 @@ function checkOptimisticSession(headers: Headers) {
return !!guessIsSignIn; return !!guessIsSignIn;
} }
export function SignInFallback() { export async function SignInFallback() {
//to avoid flash of unauthenticated state //to avoid flash of unauthenticated state
const guessIsSignIn = checkOptimisticSession(headers()); const guessIsSignIn = checkOptimisticSession(await headers());
return ( return (
<Link <Link
href={guessIsSignIn ? "/dashboard" : "/sign-in"} href={guessIsSignIn ? "/dashboard" : "/sign-in"}