Error after this.show() jet-view

Hi,

I try to had authorization control over each page in jet-view, then i have this code

//PageOne

import { JetView, plugins } from "webix-jet";
import * as controlSession from "../../views/CheckSession";
import { debug } from "util";

export default class PageOneView extends JetView {

config() {

       //if false go to forbidden page
        if (!IsAthorize("SUPERADMIN")) {
            this.show("forbidden");
        }

        const _ = this.app.getService("locale")._;

       [.....] 
  }
}

If is not athorized send to forbidden page, this page open ok.

//forbbiden page

import { JetView, plugins } from "webix-jet";
import { UnifiedUtils } from "./UnifiedUtils";

export default class ForbidenView extends JetView {
    config() {

        const _ = this.app.getService("locale")._;
        
        var ui = {
            rows: [{}, { cols: [{ width: 200 }, { view: "template", borderless: true, align: "center", template: "<center><h3>" + _("default_forbiden") + "</h3><center>" }, { width: 200}]},{}]
        }

       return ui;
    }
    init(view) {

    }
}

When i try to navigate to another page (throw simple menu sidebar) i get error. TypeError: “this.app is null”, only when this.show("forbidden"); is executed.

import { JetView, plugins } from "webix-jet";
import * as controlSession from "../../views/CheckSession";
import { debug } from "util";

export default class PageTwoView extends JetView {

config() {

        const _ = this.app.getService("locale")._;

       [.....] 
  }
}

in the code above, check if user isAthorize, when is false send to forbidden page, then, when try to navigate to another page i get the error TypeError: “this.app is null”

Please help,

Thanks in advance.

TypeError: "this.app is null"
confighttp://localhost:30894/dist/app.js:6802:13_renderhttp://localhost:30894/dist/app.js:387:22renderhttp://localhost:30894/dist/app.js:911:20_renderSubViewhttp://localhost:30894/dist/app.js:485:16_createSubViewhttp://localhost:30894/dist/app.js:480:20confighttp://localhost:30894/dist/app.js:1155:13_renderhttp://localhost:30894/dist/app.js:385:22renderhttp://localhost:30894/dist/app.js:908:20_renderSubViewhttp://localhost:30894/dist/app.js:483:16_createSubViewhttp://localhost:30894/dist/app.js:478:20 JetApp.js:242:16
JetApp</JetApp.prototype.error
JetApp.js:242:16
JetApp</JetApp.prototype._render_stage/</<
JetApp.js:299:16
config
language.js:11:9
JetView</JetView.prototype._render
JetView.js:159:22
JetBase</JetBase.prototype.render
JetBase.js:61:12
JetView</JetView.prototype._renderSubView
JetView.js:255:12
JetView</JetView.prototype._createSubView/<
JetView.js:250:20

when you navigate to other view, current view became destructed and this.app is null.

if you want to check authorization for current view, then preferred method is “app:guard” event of JetApp. or you can implement your own User plugin.