More refactoring

This commit is contained in:
Zef Hemel
2023-07-27 12:37:39 +02:00
parent 4d0f36d475
commit bfce343e7b
2 changed files with 18 additions and 7 deletions
+11 -6
View File
@@ -134,7 +134,7 @@ export class Client {
this.focus();
// This constructor will always be followed by an invocatition of init()
// This constructor will always be followed by an (async) invocatition of init()
}
/**
@@ -145,17 +145,22 @@ export class Client {
// Load settings
this.settings = await this.loadSettings();
this.initNavigator();
// Pinging a remote space to ensure we're authenticated properly, if not will result in a redirect to auth page
try {
await this.remoteSpacePrimitives.getFileMeta("SETTINGS");
} catch {
await this.remoteSpacePrimitives.ping();
} catch (e: any) {
if (e.message === "Not authenticated") {
console.warn("Not authenticated, redirecting to auth page");
return;
}
console.warn(
"Could not reach remote server, either we're offline or not authenticated",
"Could not reach remote server, we're offline or the server is down",
e,
);
}
this.initNavigator();
await this.reloadPlugs();
this.loadCustomStyles().catch(console.error);