diff --git a/src/Components/Header.js b/src/Components/Header.js index 715d6a6cc6c987bdd1962ef77d3ee6ad1b971092..7da2d87ff8f320342adf75d9494d096874239dbc 100644 --- a/src/Components/Header.js +++ b/src/Components/Header.js @@ -69,6 +69,32 @@ export default function Header(props){ if ( response.headers['access-token'] ) { sessionStorage.setItem('@portalmec/accessToken', response.headers['access-token']) } + dispatch ({ + type: "USER_LOGGED_IN", + userLoggedIn: !state.userIsLoggedIn, + login: { + askTeacherQuestion : response.data.data.ask_teacher_question, + id : response.data.data.id, + username : response.data.data.name, + email : response.data.data.email, + accessToken : response.headers['access-token'], + clientToken : response.headers.client, + userAvatar : response.data.data.avatar_file_name, + userCover : response.data.data.cover_file_name, + uid : response.data.data.uid, + followCount : response.data.data.follows_count, + collectionsCount : response.data.data.collections_count, + submitter_request : response.data.data.submitter_request, + roles : response.data.data.roles + } + } + ) + sessionStorage.setItem('@portalmec/accessToken', response.headers['access-token']) + sessionStorage.setItem('@portalmec/clientToken', response.headers.client) + sessionStorage.setItem('@portalmec/id', response.data.data.id) + sessionStorage.setItem('@portalmec/username', response.data.data.name) + sessionStorage.setItem('@portalmec/uid', response.data.data.uid) + }, (err) => { console.log(err)