Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/public/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,25 @@ import UserPreferences from './model/UserPreferences.js';
const { roles, dataAccess, pageNames } = RCT;

export default class Model extends Observable {
constructor() {
constructor(window, document) {
super();

// Bind window and document
this.document = document;
this.window = window;

// Bind session
this.session = sessionService.get();
this.session.personid = parseInt(this.session.personid, 10); // Cast, sessionService has only strings
// TODO if no personid then it is a computer so we need to parse it respectively
this.session.roles = this.getRoles();

this.router = new QueryRouter();
this.router.observe(this.handleLocationChange.bind(this));
this.router.bubbleTo(this);

this.loader = new Loader();
this.loader.bubbleTo(this);

this.userPreferences = new UserPreferences(this);
this.userPreferences.bubbleTo(this);
Expand Down
2 changes: 1 addition & 1 deletion app/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ sessionService.loadAndHideParameters();
window.sessionService = sessionService;
window.RCT = RCT;

const model = new Model();
const model = new Model(window, document);
const debug = true; // Shows when redraw is done
mount(document.body, view, model, debug);

Expand Down