diff --git a/InfoLogger/config-default.js b/InfoLogger/config-default.js index fc67c524f..cb8efe7c1 100644 --- a/InfoLogger/config-default.js +++ b/InfoLogger/config-default.js @@ -23,6 +23,7 @@ module.exports = { tls: false, allow: true, name: 'ILG', + apiAuthRoutes: true, }, // optional data source, comment object if not used diff --git a/InfoLogger/src/index.js b/InfoLogger/src/index.js index 33c9fdcad..e98f718f9 100644 --- a/InfoLogger/src/index.js +++ b/InfoLogger/src/index.js @@ -13,7 +13,7 @@ */ import { sessionService } from '/js/src/index.js'; -sessionService.loadAndHideParameters(); +const isSessionLoaded = sessionService.loadAndHideParameters({ loginUrl: '/api/login' }); // Expose sessionService to interact with it the browser's console window.sessionService = sessionService; @@ -23,20 +23,22 @@ import { mount, StatefulComponent } from '/js/src/index.js'; import view from './view.js'; import Model from './Model.js'; -// Start application -const model = new Model(); -const debug = true; // shows when redraw is done -StatefulComponent.useRenderer(model); // Register the model for the stateful components -let currentView = view; -mount(document.body, (model) => currentView(model), model, debug); +// Start application, unless the browser is being redirected to the login +if (isSessionLoaded) { + const model = new Model(); + const debug = true; // shows when redraw is done + StatefulComponent.useRenderer(model); // Register the model for the stateful components + let currentView = view; + mount(document.body, (model) => currentView(model), model, debug); -// Expose model to interact with it the browser's console -window.model = model; + // Expose model to interact with it the browser's console + window.model = model; -// Dev only: swap in the new view tree on edit and keep model state; stripped from the prod build -if (import.meta.hot) { - import.meta.hot.accept('./view.js', (newModule) => { - currentView = newModule.default; - model.notify(); - }); + // Dev only: swap in the new view tree on edit and keep model state; stripped from the prod build + if (import.meta.hot) { + import.meta.hot.accept('./view.js', (newModule) => { + currentView = newModule.default; + model.notify(); + }); + } } diff --git a/InfoLogger/test/test-config.js b/InfoLogger/test/test-config.js index 947731aa8..15edb0a1e 100644 --- a/InfoLogger/test/test-config.js +++ b/InfoLogger/test/test-config.js @@ -22,6 +22,7 @@ module.exports = { tls: false, allow: true, name: 'TST', + apiAuthRoutes: true, }, infoLoggerServer: { host: 'localhost',