@dvrd/dvr-controls 1.0.36 → 1.0.38
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.
package/package.json
CHANGED
package/src/js/util/jwtUtil.ts
CHANGED
|
@@ -19,12 +19,13 @@ export const getJwt = (): string | null => {
|
|
|
19
19
|
return null;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export const setJwt = (token: string | null, preserveOnNull: boolean = false, includeStorage: boolean = true) => {
|
|
22
|
+
export const setJwt = (token: string | null, preserveOnNull: boolean = false, includeStorage: boolean = true, _options?: CookieAttributes) => {
|
|
23
23
|
console.debug('Settings JWT token', {token, preserveOnNull, includeStorage, allowCookies: window.allowCookies});
|
|
24
24
|
jwtToken = token;
|
|
25
25
|
if (window.allowCookies || !token) {
|
|
26
26
|
if (token) {
|
|
27
27
|
let options: CookieAttributes = {expires: 1, sameSite: 'strict'};
|
|
28
|
+
if (_options) options = Object.assign({}, options, _options);
|
|
28
29
|
if (getSetting('mode') !== 'dev') {
|
|
29
30
|
options.secure = true;
|
|
30
31
|
options.sameSite = 'strict';
|
|
@@ -68,6 +69,7 @@ const getJwtFromStorage = (): string | null => {
|
|
|
68
69
|
if (item === null) return null;
|
|
69
70
|
return JSON.parse(item);
|
|
70
71
|
}
|
|
71
|
-
} catch {
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
72
74
|
return null;
|
|
73
75
|
};
|
package/src/js/util/miscUtil.ts
CHANGED
|
@@ -136,8 +136,8 @@ export const shuffleArray = (arr: any[]): any[] => {
|
|
|
136
136
|
return arr;
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
export function nullify<T extends string | Array<any> | Set<any> | number>(value?: T | null): T | null {
|
|
140
|
-
if (typeof value === 'number') {
|
|
139
|
+
export function nullify<T extends string | Array<any> | Set<any> | number | bigint>(value?: T | null): T | null {
|
|
140
|
+
if (typeof value === 'number' || typeof value === 'bigint') {
|
|
141
141
|
if (value > 0) return value;
|
|
142
142
|
return null;
|
|
143
143
|
}
|