Skip to content

Instantly share code, notes, and snippets.

@arminyahya
Last active February 22, 2020 06:36
Show Gist options
  • Save arminyahya/2e7776db5e156e283a5437fc8fe5dd65 to your computer and use it in GitHub Desktop.
Save arminyahya/2e7776db5e156e283a5437fc8fe5dd65 to your computer and use it in GitHub Desktop.
This is some lines of project appStore
import { AccessActions, SettingEnum } from '../../Enums';
import { getWord, Y } from '../../Language';
import { action, autorun, computed, observable, toJS } from 'mobx';
import { AsyncDataStatus } from '../types';
import { setAppStore, getApiResult, BaseAppStore } from 'yeganeh-common';
import { getAcrhiveCenterData, getUserArchiveCenter, convertArchiveCenterData } from './actions';
import { EdmsAppStoreLoginInfoModel, EdmsLocalStorageData, CommonLocalStorageData, ThemeModel } from './types';
import { defaultAppStoreLoginInfo, langCodes, LangCodeValue, CommonLocalStorageKeys, EdmsLocalStorageKeys, EdmsLocalStorageVersion, CommonLocalStorageVersion } from './values';
import { numericValidator } from '../validators';
import { redirectIfNeeded } from '../utilities';
type AccessListModel = Yeganeh.Common.WebApi.Models.Security.AccessListModel;
type SettingModel = Yeganeh.EDMS.WebApi.Models.Setting.SettingModel;
type VersionModel = Yeganeh.EDMS.WebApi.Models.SysInfo.VersionModel;
type ArchiveCenterModel = Yeganeh.EDMS.WebApi.Models.ArchiveCenter.ArchiveCenterModel;
export interface AppStoreI {
loginInfo: EdmsAppStoreLoginInfoModel;
}
export class EdmsBaseAppStore extends BaseAppStore<EdmsAppStoreLoginInfoModel> {
userArchiveCenters: ArchiveCenterModel[] = [];
hadFirstLogin = false;
lastRequestDate: number;
theme: ThemeModel = {
colors: 0,
listItemBackground: 0
};
@observable loginInfo: EdmsAppStoreLoginInfoModel = defaultAppStoreLoginInfo;
@observable sysInfo: { versionNumber: string; status: AsyncDataStatus } = { versionNumber: '', status: 'none' };
@observable userImg: { src: string; status: AsyncDataStatus } = { src: '', status: 'none' };
@computed get isLoggedIn() {
return !!this.loginInfo.userId;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment