Skip to content
Snippets Groups Projects
Commit 54d09633 authored by Lucas Eduardo Schoenfelder's avatar Lucas Eduardo Schoenfelder
Browse files

added functionality to commit changes made

parent f1caa218
No related branches found
No related tags found
4 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!39Update admin system,!32Homologa
...@@ -12,8 +12,15 @@ import MuiAlert from '@material-ui/lab/Alert'; ...@@ -12,8 +12,15 @@ import MuiAlert from '@material-ui/lab/Alert';
import {Alert} from '../Components/LoginModal.js' import {Alert} from '../Components/LoginModal.js'
import Grid from '@material-ui/core/Grid' import Grid from '@material-ui/core/Grid'
import CustomizedBreadcrumbs from '../Components/TabPanels/Breadcrumbs.js' import CustomizedBreadcrumbs from '../Components/TabPanels/Breadcrumbs.js'
import axios from 'axios'
import {getAxiosConfig} from '../Components/HelperFunctions/getAxiosConfig'
import {apiUrl} from '../env.js'
import {Store} from '../Store.js'
export default function EditProfilePage (props) { export default function EditProfilePage (props) {
const {state} = useContext(Store)
const id = state.currentUser.id
const [tabs, setTabs] = useState([ const [tabs, setTabs] = useState([
'Editar Perfil', 'Solicitar conta de Professor', 'Gerenciar Conta' 'Editar Perfil', 'Solicitar conta de Professor', 'Gerenciar Conta'
]) ])
...@@ -30,6 +37,28 @@ export default function EditProfilePage (props) { ...@@ -30,6 +37,28 @@ export default function EditProfilePage (props) {
handleSnackbar(false); handleSnackbar(false);
} }
const updateUserInfo = (newUserInfo) => {
console.log(newUserInfo)
let config = getAxiosConfig()
axios.put( (`${apiUrl}/users/` + id), newUserInfo, config
).then (
(res) => {
console.log(res)
if ( res.headers['access-token'] ) {
sessionStorage.setItem('@portalmec/accessToken', res.headers['access-token'])
}
props.history.push('/perfil')
},
(err) => {
console.log(err)
}
)
}
return ( return (
<div style={{backgroundColor:"#f4f4f4", color:"#666"}}> <div style={{backgroundColor:"#f4f4f4", color:"#666"}}>
<Snackbar open={snackbarOpened} autoHideDuration={1000} onClose={handleCloseSnackbar} <Snackbar open={snackbarOpened} autoHideDuration={1000} onClose={handleCloseSnackbar}
...@@ -66,7 +95,7 @@ export default function EditProfilePage (props) { ...@@ -66,7 +95,7 @@ export default function EditProfilePage (props) {
</Grid> </Grid>
<TabContentDiv item xs={9}> <TabContentDiv item xs={9}>
<Paper elevation={3} style= {{width:"100%"}}> <Paper elevation={3} style= {{width:"100%"}}>
{tabValue === 0 && <TabPanelEditarPerfil />} {tabValue === 0 && <TabPanelEditarPerfil updateUserInfo={updateUserInfo}/>}
{tabValue === 1 && <TabPanelSolicitarContaProfessor/>} {tabValue === 1 && <TabPanelSolicitarContaProfessor/>}
</Paper> </Paper>
{tabValue === 2 && <TabPanelGerenciarConta handleSnackbar={() => {handleSnackbar(true)}}/>} {tabValue === 2 && <TabPanelGerenciarConta handleSnackbar={() => {handleSnackbar(true)}}/>}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment