style(components): standardize main component file formatting
This commit is contained in:
@@ -1,44 +1,44 @@
|
||||
"use client"
|
||||
"use client";
|
||||
|
||||
import { signOut, useSession } from "@/lib/auth-client"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { toast } from "sonner"
|
||||
import { signOut, useSession } from "@/lib/auth-client";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export default function SignIn() {
|
||||
const { data: session, isPending } = useSession()
|
||||
const router = useRouter()
|
||||
const { data: session, isPending } = useSession();
|
||||
const router = useRouter();
|
||||
|
||||
const handleSignOut = async () => {
|
||||
try {
|
||||
await signOut()
|
||||
router.push("/")
|
||||
} catch (_error) {
|
||||
toast.error("Failed to sign out. Please try again.")
|
||||
}
|
||||
}
|
||||
const handleSignOut = async () => {
|
||||
try {
|
||||
await signOut();
|
||||
router.push("/");
|
||||
} catch (_error) {
|
||||
toast.error("Failed to sign out. Please try again.");
|
||||
}
|
||||
};
|
||||
|
||||
if (isPending) {
|
||||
return <div className="h-8 w-16 bg-muted animate-pulse rounded"></div>
|
||||
}
|
||||
if (isPending) {
|
||||
return <div className="h-8 w-16 bg-muted animate-pulse rounded"></div>;
|
||||
}
|
||||
|
||||
if (session?.user) {
|
||||
return (
|
||||
<div className="flex items-center gap-4">
|
||||
<Button onClick={handleSignOut} variant="ghost" size="default">
|
||||
Sign Out
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
if (session?.user) {
|
||||
return (
|
||||
<div className="flex items-center gap-4">
|
||||
<Button onClick={handleSignOut} variant="ghost" size="default">
|
||||
Sign Out
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Button
|
||||
onClick={() => router.push("/auth/signin")}
|
||||
variant="outline"
|
||||
size="default"
|
||||
>
|
||||
Sign In
|
||||
</Button>
|
||||
)
|
||||
return (
|
||||
<Button
|
||||
onClick={() => router.push("/auth/signin")}
|
||||
variant="outline"
|
||||
size="default"
|
||||
>
|
||||
Sign In
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user