// Set/Remove user and token to local storage export const setUserSession = (token, user) => { localStorage.setItem('token', token); localStorage.setItem('user', JSON.stringify(user)); }; export const getUser = () => { const userJSON = localStorage.getItem('user'); if (userJSON) { const user = JSON.parse(userJSON); return user; } else return null; }; export const getToken = () => { const token = localStorage.getItem('token'); if (token) return token; else return null; }; export const removeUserSession = () => { localStorage.removeItem('token'); localStorage.removeItem('user'); };