membros-react-sdk
Version:
React authentication library for Membros platform with subscription management and plan-based access control
19 lines • 659 B
JavaScript
"use client";
import { jsx as _jsx } from "react/jsx-runtime";
import { useAuth } from "../AuthContext.esm.js";
export function LoginButton({ children = "Log in", className, options, mode = "redirect" }) {
const { isAuthenticated, loginWithRedirect, loginWithPopup } = useAuth();
const handleLogin = () => {
if (mode === "popup") {
loginWithPopup(options);
}
else {
loginWithRedirect(options);
}
};
if (isAuthenticated) {
return null;
}
return (_jsx("button", { onClick: handleLogin, className: className, children: children }));
}
//# sourceMappingURL=LoginButton.js.map