@caseparts-org/casecore 0.0.8 → 0.0.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.
|
@@ -29,6 +29,6 @@ export type Credentials = {
|
|
|
29
29
|
email: string;
|
|
30
30
|
password: string;
|
|
31
31
|
};
|
|
32
|
-
export declare const AuthContext: React.Context<AuthContextType
|
|
33
|
-
export declare const useAuthContext: () => AuthContextType
|
|
32
|
+
export declare const AuthContext: React.Context<AuthContextType>;
|
|
33
|
+
export declare const useAuthContext: () => AuthContextType;
|
|
34
34
|
export default function AuthProvider({ children, urls, apiKey, sessionClientId }: AuthProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,21 @@ import { jwtDecode } from "jwt-decode";
|
|
|
4
4
|
import useLocalStorage from "../hooks/useLocalStorage";
|
|
5
5
|
import { getSessionId } from '../utils/SessionUtils';
|
|
6
6
|
import { buildClaimsFromPayload } from "../utils/ClaimsUtils";
|
|
7
|
-
|
|
7
|
+
const defaultAuthContext = {
|
|
8
|
+
initialized: "",
|
|
9
|
+
claims: null,
|
|
10
|
+
email: "",
|
|
11
|
+
discountLevel: "",
|
|
12
|
+
userType: "",
|
|
13
|
+
login: async () => { },
|
|
14
|
+
logout: async () => false,
|
|
15
|
+
impersonate: async () => null,
|
|
16
|
+
fetch: async () => null,
|
|
17
|
+
hasRight: () => false,
|
|
18
|
+
token: null,
|
|
19
|
+
sessionId: null,
|
|
20
|
+
};
|
|
21
|
+
export const AuthContext = createContext(defaultAuthContext);
|
|
8
22
|
export const useAuthContext = () => {
|
|
9
23
|
return useContext(AuthContext);
|
|
10
24
|
};
|