@inertiapixel/nextjs-auth
Version:
Authentication system for Next.js. Supports credentials and social login, JWT token management, and lifecycle hooks — designed to integrate with nodejs-auth for full-stack MERN apps.
11 lines (10 loc) • 435 B
TypeScript
import { ComponentType, FC } from 'react';
/**
* Higher-Order Component that protects a page/component by requiring authentication.
* It leverages the `useAuth` hook, so all redirect logic is centralized there.
*
* @example
* const OrdersPage = () => <div>Orders</div>;
* export const ProtectedOrdersPage = withAuth(OrdersPage);
*/
export declare const withAuth: <P extends object>(WrappedComponent: ComponentType<P>) => FC<P>;