Users Store
This store is responsible for holding all the data and logic surrounding users, but also helps the chats store initializing when a user is logged in:
/*** src/stores/users.js ***/
import {observable, computed, map, toJS, action} from 'mobx';
import chats from './chats'
import firebase from 'firebase';
import { firebaseApp } from '../firebase';
import notifications from '../notifications'
class Users {
@observable id = null;
@observable isLoggedIn = false;
@observable name = null;
@observable avatar = null;
@observable notificationsToken = null;
@observable loggingIn = false;
@observable registering = false;
@observable loggingError = null;
@observable registeringError = null;
@action login = function(username, password) {
//login with Firebase email/password method
}
@action logout = function() {
//logout from Firebase authentication service
...