educt-client/src/stores/RootStore.ts
2021-08-25 12:02:05 +03:00

41 lines
766 B
TypeScript

import { makeAutoObservable } from 'mobx';
import { API_BASE_URL } from '../constants';
/**
* Services
*/
import ApiService from 'services/ApiService';
/**
* Stores
*/
import AuthStore from './AuthStore';
import UserStore from './UserStore';
export default class RootStore {
public authStore: AuthStore;
public userStore: UserStore;
public apiService: ApiService;
constructor() {
/**
* Api service
*/
this.apiService = new ApiService(this, {
baseURL: API_BASE_URL,
responseType: 'json',
withCredentials: true,
});
/**
* Stores
*/
this.authStore = new AuthStore(this, this.apiService.api);
this.userStore = new UserStore(this, this.apiService.api);
makeAutoObservable(this);
}
}