'use client'; import React from 'react'; import { SuperTokensWrapper } from 'supertokens-auth-react'; import SuperTokensReact from 'supertokens-auth-react'; import { frontendConfig, setRouter } from '../config/frontend'; import { usePathname, useRouter } from 'next/navigation'; if (typeof window !== 'undefined') { // we only want to call this init function on the frontend, so we check typeof window !== 'undefined' SuperTokensReact.init(frontendConfig()); } export const SuperTokensProvider: React.FC> = ({ children, }) => { setRouter(useRouter(), usePathname() || window.location.pathname); return {children}; };