@inertiapixel/nextjs-auth
Version:
A reusable Next.js authentication package supporting credentials, OTP, and OAuth login.
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>;