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