1
0
mirror of https://github.com/franjsco/tick3t synced 2024-12-26 17:33:27 +01:00

refactor: localStorage -> sessionStorage

This commit is contained in:
Francesco Esposito 2019-07-31 21:48:36 +02:00
parent 50f3ae582b
commit 5c05e84ccc
3 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@ export const PrivateRoute = ({ component: Component, ...rest }) => {
<Route
{...rest}
render={props => (
localStorage.getItem('user')
sessionStorage.getItem('user')
? <Component {...props} />
: <Redirect to={{ pathname: '/login', state: { from: props.location }}} />
)}

View File

@ -1,5 +1,5 @@
export function authHeader() {
let user = JSON.parse(localStorage.getItem('user'));
let user = JSON.parse(sessionStorage.getItem('user'));
if (user.data.token) {
return `Bearer ${user.data.token}` ;

View File

@ -1,6 +1,6 @@
import { userConstants } from '../_constants/user.constants';
let userLocalStorage = JSON.parse(localStorage.getItem('user'));
let userLocalStorage = JSON.parse(sessionStorage.getItem('user'));
const initialState = userLocalStorage ? {loggedIn: true} : {loggedIn: false};