2022-05-29 15:14:03 +03:00

28 lines
559 B
TypeScript

/* eslint-disable import/no-cycle */
import { makeAutoObservable } from 'mobx';
import type { User } from 'services/user/types';
import type RootStore from './root';
export default class UserStore {
root: RootStore;
user?: User = undefined;
constructor(rootStore: RootStore) {
makeAutoObservable(this);
this.root = rootStore;
}
hydrate = (user: User) => {
this.user = user;
};
getDomainName() {
if (this.user) {
const { username, domain } = this.user;
return `${domain}\\${username}`;
}
return '';
}
}