Skip to content
Snippets Groups Projects
Commit 02f578b9 authored by lfr20's avatar lfr20
Browse files

Give rigth identation

parent fedd4711
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,!34Fix search
...@@ -27,7 +27,7 @@ import Snackbar from '@material-ui/core/Snackbar'; ...@@ -27,7 +27,7 @@ import Snackbar from '@material-ui/core/Snackbar';
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
import { useLocation } from 'react-router-dom' import { useLocation } from 'react-router-dom'
import MenuBarMobile from './MenuBarMobile.js' import MenuBarMobile from './MenuBarMobile.js'
import {validateGoogleLoginToken} from './HelperFunctions/getAxiosConfig' import { validateGoogleLoginToken } from './HelperFunctions/getAxiosConfig'
//const StyledButton = styled(Button)` //const StyledButton = styled(Button)`
// background : #ffa54c !important; // background : #ffa54c !important;
...@@ -38,90 +38,82 @@ function Alert(props) { ...@@ -38,90 +38,82 @@ function Alert(props) {
} }
export default function Header(props){ export default function Header(props) {
const { state, dispatch } = useContext(Store) const { state, dispatch } = useContext(Store)
const [signUpOpen, setSignUp] = useState(false) const [signUpOpen, setSignUp] = useState(false)
const [loginOpen, setLogin] = useState(false) const [loginOpen, setLogin] = useState(false)
const [successfulLoginOpen, handleSuccessfulLogin] = useState(false) const [successfulLoginOpen, handleSuccessfulLogin] = useState(false)
const [modalColaborar, setModalColaborar] = useState(false) const [modalColaborar, setModalColaborar] = useState(false)
function handleSuccessValidateToken (data) { function handleSuccessValidateToken(data) {
dispatch ({ dispatch({
type: "USER_LOGGED_IN", type: "USER_LOGGED_IN",
userLoggedIn: !state.userIsLoggedIn, userLoggedIn: !state.userIsLoggedIn,
login: data.data login: data.data
} }
) )
} }
/* useEffect( () => { let loc = useLocation()
if (sessionStorage.getItem('@portalmec/auth_headers')) { useEffect(() => {
let config = { headers : JSON.parse(sessionStorage.getItem('@portalmec/auth_headers'))} let query = new URLSearchParams(loc.search)
validateToken(config, handleSuccessValidateToken, (error) => {console.log(error)}) if (query.get("auth_token")) {
} let config = {
}, [])*/ headers: {
"access-token": query.get("auth_token"),
let loc = useLocation() "client": query.get("client_id"),
useEffect(() => { "uid": query.get("uid"),
let query = new URLSearchParams(loc.search) "expiry": query.get("expiry"),
"token-type": 'Bearer'
if(query.get("auth_token")) { }
let config = { }
headers : { validateGoogleLoginToken(config, handleSuccessValidateToken, (error) => { console.log(error) })
"access-token" : query.get("auth_token"), redirect()
"client" : query.get("client_id"), }
"uid" : query.get("uid"), }, [loc])
"expiry" : query.get("expiry"),
"token-type" : 'Bearer' useEffect(() => {
} if (state.currentUser.askTeacherQuestion === true) {
} dispatch({
validateGoogleLoginToken(config, handleSuccessValidateToken, (error) => {console.log(error)}) type: "TOGGLE_MODAL_COLABORAR_PLATAFORMA",
redirect() modalColaborarPlataformaOpen: true
} });
}, [loc]) }
}, [state.currentUser.askTeacherQuestion])
useEffect ( () => {
if (state.currentUser.askTeacherQuestion === true) { const redirect = () => {
dispatch({ props.history.push('/')
type: "TOGGLE_MODAL_COLABORAR_PLATAFORMA", }
modalColaborarPlataformaOpen: true
}); const toggleSnackbar = (event, reason) => {
} if (reason === 'clickaway') {
}, [state.currentUser.askTeacherQuestion]) return;
}
const redirect = () => {
props.history.push('/') handleSuccessfulLogin(false);
} }
const toggleSnackbar = (event, reason) => { const handleSignUp = () => {
if (reason === 'clickaway') { setSignUp(!signUpOpen)
return; }
}
const handleLogin = () => {
handleSuccessfulLogin(false); setLogin(!loginOpen)
} }
const handleSignUp = () => { const handleClickSearch = (open) => {
setSignUp(!signUpOpen) dispatch({
} type: "HANDLE_SEARCH_BAR",
opened: !state.searchOpen
const handleLogin = () => { })
setLogin(!loginOpen) }
}
let windowWidth = window.innerWidth
const handleClickSearch = (open) => {
dispatch({ return (
type: "HANDLE_SEARCH_BAR", <React.Fragment>
opened: !state.searchOpen {/*
})
}
let windowWidth = window.innerWidth
return (
<React.Fragment>
{/*
windowWidth > 990 && windowWidth > 990 &&
<AcessibilityBar/> <AcessibilityBar/>
*/} */}
......
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