"use client";

import React from "react";
import { useEffect } from "react";
import SuperTokensReact from "supertokens-auth-react";
import { frontendConfig } from "@/lib/supertokens/frontendConfig";

export const SuperTokensProvider: React.FC<React.PropsWithChildren<{}>> = ({
  children,
}) => {
  useEffect(() => {
    if (typeof window !== "undefined") {
      SuperTokensReact.init(frontendConfig());
    }
  }, []);

  return <>{children}</>;
};
