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 ...
Get React: Cross-Platform Application Development with React Native now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.