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 ...

Get React Native Blueprints now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.