Web: Client: move init tfa to setupStore

This commit is contained in:
Viktor Fomin 2022-04-08 12:23:54 +03:00
parent b72d14dc98
commit 797c71551b
2 changed files with 18 additions and 1 deletions

View File

@ -563,7 +563,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
);
};
const ShellWrapper = inject(({ auth, backup }) => {
const ShellWrapper = inject(({ auth, backup, setup }) => {
const { init, isLoaded, settingsStore, setProductVersion, language } = auth;
const {
personal,
@ -578,9 +578,11 @@ const ShellWrapper = inject(({ auth, backup }) => {
setTheme,
} = settingsStore;
const { setPreparationPortalDialogVisible } = backup;
const { initSettings } = setup;
return {
loadBaseInfo: async () => {
await init();
await initSettings();
setModuleInfo(config.homepage, "home");
setProductVersion(config.version);

View File

@ -2,12 +2,16 @@ import api from "@appserver/common/api";
import { makeAutoObservable } from "mobx";
const { Filter } = api;
import SelectionStore from "./SelectionStore";
import authStore from "@appserver/common/store/AuthStore";
import { combineUrl } from "@appserver/common/utils";
import { AppServerConfig } from "@appserver/common/constants";
import config from "../../package.json";
class SettingsSetupStore {
selectionStore = null;
authStore = null;
isInit = false;
common = {
whiteLabel: {
@ -45,9 +49,20 @@ class SettingsSetupStore {
constructor() {
this.selectionStore = new SelectionStore(this);
this.authStore = authStore;
makeAutoObservable(this);
}
initSettings = async () => {
if (this.isInit) return;
this.isInit = true;
console.log("INIT STORE");
if (authStore.isAuthenticated) {
authStore.tfaStore.getTfaType();
}
};
setIsLoading = (isLoading) => {
this.security.accessRight.isLoading = isLoading;
};