Update startup sequence

This commit is contained in:
Pierre HUBERT 2021-02-20 10:58:28 +01:00
parent 69092db808
commit 3f8dbb3f36

View File

@ -34,14 +34,12 @@ const System = {
Page.location_updated(e);
}
/**
* Prepare login
*/
//Clean current page content
Page.emptyPage();
//Show a wait splash screen
Page.showWaitSplashScreen("Starting up...");
Page.showWaitSplashScreen(tr("Starting up..."));
/**
* Language initator
@ -58,13 +56,26 @@ const System = {
*/
ComunicWeb.components.darkTheme.refresh();
/**
* Initialize server configuration
*/
Page.showWaitSplashScreen(tr("Loading server configuration"));
try {
ServerConfig.ensureLoaded();
} catch(e) {
console.error(e)
Page.showTransparentWaitSplashScreen(tr("Failed to load server configuration! Please try again by refreshing the page!"));
}
/**
* Get login state
*/
Page.showWaitSplashScreen(tr("Refreshing login state"));
await UserLogin.refreshLoginState();
// Initialize Websocket if user is connected
if(signed_in()) {
Page.showWaitSplashScreen(tr("Connecting to server"));
await UserWebSocket.Connect();
await UserWebSocket.WaitForConnected();
}