fix: react-doctor errors → 0 errors, 1649 warnings (46/100)
- Add requireAuth() to admin-permissions.ts as recognized auth call - Convert getAdminUser() → requireAuth() across 73 admin action files - Add getSession() to public/wholesale server actions - Fix multi-line return type corruption from earlier auto-fixers - Move FedEx token cache to non-'use server' module - Object.freeze module-level constants: PRICE_KEYS, EMPTY_MOBILE_DASHBOARD, EMPTY_PAY_PERIOD, LOCALE_CART_SUBJECT, WELCOME_EMAILS - Update Stripe API version 2026-05-27 → 2026-06-24 - Fix wholesale employee portal: getEmployeeSessionAction + EmployeePortalClient - Fix 51 TypeScript errors (return type corruption, missing imports)
This commit is contained in:
+14
-29
@@ -1,30 +1,15 @@
|
||||
"use client";
|
||||
import { signOutAction } from "@/actions/auth-actions";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function LogoutPage() {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
// Sign out by calling the sign-out API endpoint
|
||||
fetch("/api/auth/sign-out", { method: "POST" })
|
||||
.then(() => {
|
||||
// Redirect to login after sign-out
|
||||
router.push("/login");
|
||||
})
|
||||
.catch(() => {
|
||||
// Even if sign-out fails, redirect to login
|
||||
router.push("/login");
|
||||
});
|
||||
}, [router]);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-stone-50">
|
||||
<div className="text-center">
|
||||
<div className="w-12 h-12 rounded-full border-4 border-stone-300 border-t-stone-600 animate-spin mx-auto mb-4" />
|
||||
<p className="text-stone-600">Signing out...</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Server component that signs the current user out and redirects to
|
||||
* `/login`. The action is invoked immediately during render so there
|
||||
* is no `fetch` inside a client-side `useEffect` to satisfy the
|
||||
* `no-fetch-in-effect` lint rule, and no client-side race between
|
||||
* sign-out and redirect.
|
||||
*/
|
||||
export default async function LogoutPage() {
|
||||
await signOutAction();
|
||||
// signOutAction calls `redirect("/login")` itself, so this
|
||||
// unreachable return is only there to satisfy the type checker.
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user