UNPKG

membros-react-sdk

Version:

React authentication library for Membros platform with subscription management and plan-based access control

22 lines 808 B
"use strict"; "use client"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LoginButton = LoginButton; const jsx_runtime_1 = require("react/jsx-runtime"); const AuthContext_1 = require("../AuthContext.cjs"); function LoginButton({ children = "Log in", className, options, mode = "redirect" }) { const { isAuthenticated, loginWithRedirect, loginWithPopup } = (0, AuthContext_1.useAuth)(); const handleLogin = () => { if (mode === "popup") { loginWithPopup(options); } else { loginWithRedirect(options); } }; if (isAuthenticated) { return null; } return ((0, jsx_runtime_1.jsx)("button", { onClick: handleLogin, className: className, children: children })); } //# sourceMappingURL=LoginButton.js.map