@vyro-x/react-auth
Advanced tools
Comparing version 1.0.13 to 1.0.14
@@ -5,7 +5,8 @@ import { AuthArgs } from './types'; | ||
action: AuthAction; | ||
onAuth: (user: { | ||
onAuth?: (user: { | ||
id: string; | ||
}) => any; | ||
onLogout?: () => any; | ||
authArgs?: AuthArgs; | ||
}; | ||
export declare const EmbeddedAuth: (props: EmbeddedAuthProps) => import("react/jsx-runtime").JSX.Element; |
@@ -13,3 +13,3 @@ "use strict"; | ||
const EmbeddedAuth = (props) => { | ||
const { action, onAuth, authArgs } = props; | ||
const { action, onAuth, onLogout, authArgs } = props; | ||
const config = (0, config_1.getConfig)(); | ||
@@ -32,2 +32,9 @@ const [height, setHeight] = (0, react_1.useState)(0); | ||
} | ||
if (data.code === 'logout') { | ||
// Refresh the auth context to reflect the logged out user | ||
auth.checkIsAuthenticated(); | ||
if (typeof onLogout === 'function') { | ||
onLogout(); | ||
} | ||
} | ||
if (data.code === 'height') { | ||
@@ -34,0 +41,0 @@ setHeight(data.payload.height); |
{ | ||
"name": "@vyro-x/react-auth", | ||
"description": "Client authentication", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
31711
645