Skip to content
Shawn DelPercio edited this page May 27, 2020 · 3 revisions

Utils

A set of utility functions to use throughout the app.

PrivateRoute.js

A higher order component that takes in a component and props, and returns a new Route only if a token exists in localstorage. If token does not exist, returns a redirect component to the root url.

axiosToDS.js

Returns an axios promise to make requests to the DS Allay API. Sets the baseURL to https://allay23-staging-ds.herokuapp.com/. Also runs request through the cors anywhere api by heroku, https://cors-anywhere.herokuapp.com/

axiosWithAuth.js

Returns an axios promise to make requests to the Allay back-end API. Sets the baseURL to the environmental variable named 'REACT_APP_databaseURL'. Also adds the token in localstorage onto the authorization header with every request made using this function.