Skip to content

Components (Auth)

Shawn DelPercio edited this page May 26, 2020 · 2 revisions

Component Tree

/Auth

Login.js

Component rendered in the root route. Handles email and password inputs for authentication.

Routes to '/dashboard' on successful login.

Sends:

{
  email: 'email@email.com',
  password: 'password'
}

On Successful Login Receives:

{
  data: {
    admin: false,
    blocked: false,
    email: 'email@email.com',
    first_name: 'John',
    last_name: 'Doe',
    id: 27,
    token: 'some token here'
    },
  ...
}

Stores in Local Storage:

  • token as 'token'
  • first_name as 'name'
  • id as 'userId'
  • email as 'email'

Signup.js

Component rendered in '/signup' route. Allows user to quickly sign up with few fields, or return to login page. All fields in Signup.js are required and have validation associated with each. Emails are unique, but there is no feedback if someone tries signing up with an email that has already been used.

Routes to '/dashboard' upon successful signup.

Sends:

{
  first_name: 'John',
  last_name: 'Doe',
  email: 'email@email.com',
  track_id: 1(Android) 2(DS) 3(WEB) 4(iOS) 5(UX),
  cohort: 'FT-27',
  password: 'password',
  ...
}

On Successful Signup Receives:

{
  data: {
    token: 'token here',
    user: {
      first_name: 'John',
      last_name: 'Doe',
      email: 'email@email.com',
      track_id: 1(Android) 2(DS) 3(WEB) 4(iOS) 5(UX),
      cohort: 'FT-27',
      id: 38
      ...
      }
  }  
}

Stores in Local Storage:

  • token as 'token'
  • first_name as 'name'
  • id as 'userId'
  • email as 'email'

Signup-Additional.js

Component rendered in '/signup' route. This component is only rendered if the 'Add Additional Information' text is clicked in Signup.js. Contains many fields for additional profile information, and cloudinary image/resume uploads.

These fields get added to the signup object that gets sent to the back-end regardless if they're filled in or not. If they are not filled in they default to null

Total Signup Field Object Sends:

{
  cohort: "FT-27"
  contact_email: null
  dribble: null
  email: "something@something.com"
  employed_company: null
  employed_remote: false
  employed_start: null
  employed_title: null
  field_of_study: null
  first_name: "John"
  github: null
  graduated: null
  highest_ed: null
  last_name: "Doe"
  linked_in: null
  location: "undefined undefined"
  portfolio: null
  prior_experience: false
  profile_image: null
  resume: null
  slack: null
  tlsl_experience: false
  track_id: 2
}