@evoke-platform/context 1.3.0-dev.7 → 1.3.0-dev.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -100,21 +100,26 @@ function OidcProvider({ authRequest, children }) {
|
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
}, [auth, authRequest]);
|
|
103
|
-
const context = useMemo(() =>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
103
|
+
const context = useMemo(() => {
|
|
104
|
+
var _a, _b, _c;
|
|
105
|
+
return auth.isAuthenticated && auth.user
|
|
106
|
+
? {
|
|
107
|
+
account: {
|
|
108
|
+
id: auth.user.profile.sub,
|
|
109
|
+
name: (_a = auth.user.profile.name) !== null && _a !== void 0 ? _a : (`${(_b = auth.user.profile.given_name) !== null && _b !== void 0 ? _b : ''} ${(_c = auth.user.profile.family_name) !== null && _c !== void 0 ? _c : ''}` ||
|
|
110
|
+
undefined),
|
|
111
|
+
lastLoginTime: auth.user.profile.lastLoginTime,
|
|
112
|
+
},
|
|
113
|
+
logout: () => {
|
|
114
|
+
auth.signoutRedirect({
|
|
115
|
+
// Fusion auth requires an absolute url.
|
|
116
|
+
post_logout_redirect_uri: `${window.location.origin}/logout`,
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
getAccessToken,
|
|
120
|
+
}
|
|
121
|
+
: undefined;
|
|
122
|
+
}, [auth, getAccessToken]);
|
|
118
123
|
return _jsx(Context.Provider, { value: context, children: children });
|
|
119
124
|
}
|
|
120
125
|
export function useAuthenticationContext() {
|