Change page that will be loaded based on variable


#1

Hi,
i’m using simple system to log users. If data is filled, im writing this data in application-settings.
So for now, i want to check if user is already logged, and show login page or main page.

I wrote this piece of code in app.js but this will not work. Is there a way to accomplish this ? Thanks for advice.

require("./bundle-config");
require(’~/_common/js.js’);

var application = require(“application”);
var appSettings = require(“application-settings”);

application.on(application.launchEvent, function (args) {
if (appSettings.getBoolean(‘is_logged’) == true) {
application.start({ moduleName: “auth/auth” });
} else {
application.start({ moduleName: “home/home” });
}
});


#2

hey @Konrad, take a look at mentioned links.

this may help you!


#3

Hi kumaran,
Thank you - i will def check those.
Greetings.