Skip to content
Sam Codrington edited this page Jan 16, 2018 · 1 revision

Welcome to the smx-frontend wiki!

User Data

All user data is stored under the App.js container's state, with two fields user and isLoggedIn.

user has the following fields:

Field Info
_id Contains the user id, which is the primary key for associated information in the database
username Contains username of the user (could be redundant at this point)
namefirst First Name of User
nameLast Last Name of User
email Email of User
school School of User
textbook_ids Contains id(s) of textbook corresponding to their primary keys in the database

There is a helpful method called changeLoginStatus() in App.js which can be passed to other components/containers, requiring one parameter: login. login should be a boolean. If login is passed in as false, in addition to setting isLoggedIn to false, the user state is also wiped (set to null). Note: changeLoginStatus() does not automatically set user info if passed in as true. However there is a method addUserInfo() which updates the user state to the paramter passed in (usually from the axios request for POST /auth/login)

Clone this wiki locally