You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
import { makeAutoObservable } from "mobx";
|
|
import { Reservation } from "./Reservation";
|
|
import { Auth } from "./Auth";
|
|
import {Invoice} from "./Invoice";
|
|
import Report from "./Report";
|
|
|
|
class Root {
|
|
constructor() {
|
|
this.reservationStore = new Reservation(this);
|
|
this.authStore = new Auth(this);
|
|
this.invoiceStore = new Invoice(this);
|
|
this.reportStore = new Report(this);
|
|
makeAutoObservable(this);
|
|
}
|
|
|
|
clearSession() {
|
|
if (window.sessionStorage) {
|
|
const sessionStorage = window.sessionStorage;
|
|
sessionStorage.clear();
|
|
} else {
|
|
console.error('browser not support sessionStorage!');
|
|
}
|
|
}
|
|
|
|
getSession(key) {
|
|
if (window.sessionStorage) {
|
|
const sessionStorage = window.sessionStorage;
|
|
return sessionStorage.getItem(key);
|
|
} else {
|
|
console.error('browser not support sessionStorage!');
|
|
return null;
|
|
}
|
|
}
|
|
|
|
putSession(key, value) {
|
|
if (window.sessionStorage) {
|
|
const sessionStorage = window.sessionStorage;
|
|
return sessionStorage.setItem(key, value);
|
|
} else {
|
|
console.error('browser not support sessionStorage!');
|
|
}
|
|
}
|
|
}
|
|
|
|
export default Root;
|