@axium/client 0.37.0 → 0.37.2
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/dist/web/hooks.js +3 -8
- package/package.json +1 -1
package/dist/web/hooks.js
CHANGED
|
@@ -7,20 +7,15 @@ import { loadLocale } from './locales.js';
|
|
|
7
7
|
import * as pwa from './pwa.js';
|
|
8
8
|
const day = 86400_000;
|
|
9
9
|
export async function init() {
|
|
10
|
-
await loadLocale().catch(() => { });
|
|
11
10
|
const session = await getCurrentSession().catch(() => null);
|
|
12
11
|
await loadFeatures(session?.userId).catch(() => { });
|
|
13
|
-
if (session && session.expires.getTime() < Date.now() + day)
|
|
14
|
-
try {
|
|
15
|
-
await extendCurrentSession(session.userId);
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
console.debug('Failed to extend current session');
|
|
19
|
-
}
|
|
20
12
|
if (feature('pwa'))
|
|
21
13
|
void pwa.register().catch(e => console.debug('Failed to register service worker:', errorText(e)));
|
|
22
14
|
else
|
|
23
15
|
void pwa.unregister().catch(() => { });
|
|
16
|
+
await loadLocale().catch(() => { });
|
|
17
|
+
if (session && session.expires.getTime() < Date.now() + day)
|
|
18
|
+
void extendCurrentSession(session.userId).catch(() => console.debug('Failed to extend current session'));
|
|
24
19
|
if (feature('themes')) {
|
|
25
20
|
const theme = themeStyles[session?.user?.preferences?.theme || 'default'] || {};
|
|
26
21
|
for (const [prop, value] of Object.entries(theme))
|