Skip to content

Commit

Permalink
add infos in Menu
Browse files Browse the repository at this point in the history
  • Loading branch information
AldemirLucas committed Oct 31, 2023
1 parent 6717bda commit c400fc1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
16 changes: 9 additions & 7 deletions next/components/molecules/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ function MenuDrawer({ isOpen, onClose, links }) {

function MenuDrawerUser({ isOpen, onClose}) {
const router = useRouter()
let userData = cookies.get("user") || null
if(userData !== null) userData = JSON.parse(cookies.get("user"))

const links = [
{name: "Perfil público", value: "profile"},
Expand Down Expand Up @@ -163,7 +165,7 @@ function MenuDrawerUser({ isOpen, onClose}) {
alt=""
width="100%"
height="100%"
src="https://basedosdados-static.s3.us-east-2.amazonaws.com/equipe/sem_foto.png"
src={userData?.picture ? userData?.picture : "https://basedosdados-static.s3.us-east-2.amazonaws.com/equipe/sem_foto.png"}
/>
</Box>
<Text
Expand All @@ -173,15 +175,15 @@ function MenuDrawerUser({ isOpen, onClose}) {
fontWeight="400"
lineHeight="27px"
letterSpacing="0.3px"
>Dadinho</Text>
>{userData?.username ? userData?.username : "Dadinho"}</Text>
<Text
color="#6F6F6F"
fontFamily="Ubuntu"
fontSize="14px"
fontWeight="400"
lineHeight="27px"
letterSpacing="0.3px"
>[email protected]</Text>
>{userData?.email ? userData?.email : "[email protected]"}</Text>
</Stack>

<Accordion allowToggle width="100%" defaultIndex={0}>
Expand Down Expand Up @@ -346,7 +348,7 @@ function MenuUser ({ userData, onOpen, onClose }) {
lineHeight="16px"
letterSpacing="0.3px"
>
Dadinho
{userData?.username ? userData?.username : "dadinho"}
</Text>
<Text
color="#6F6F6F"
Expand All @@ -356,7 +358,7 @@ function MenuUser ({ userData, onOpen, onClose }) {
lineHeight="16px"
letterSpacing="0.3px"
>
[email protected]
{userData?.email ? userData?.email : "[email protected]"}
</Text>
</MenuItem>

Expand Down Expand Up @@ -586,7 +588,7 @@ function DesktopLinks({ links, position = false, path }) {
{!statusSearch &&
<HStack spacing={8} display={{ base: "none", lg: "flex" }}>
{userData ? (
<MenuUser />
<MenuUser userData={userData}/>
) : (
<>
<Link fontSize="15px" fontFamily="Ubuntu" fontWeight="400" letterSpacing="0.3px" href="/user/login">
Expand Down Expand Up @@ -625,7 +627,7 @@ export default function MenuNav({}) {
{icon: <BDLogoProImage widthImage="54px"/>, name: "Dados exclusivos", href: "https://info.basedosdados.org/bd-pro"},
{icon: <BDLogoEduImage widthImage="54px"/>, name: "Curso de dados", href: "https://info.basedosdados.org/bd-edu"},
{},
{name: "Serviços", href: "/servicos"},
{name: "Serviço", href: "/servicos"},
{},
{name: "Estudos de caso", href: "/estudos-de-caso"}
],
Expand Down
4 changes: 2 additions & 2 deletions next/middlewares/authUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ async function isJWTInvalid(token) {
export default async function authUser(context, destiny) {
const { req, res } = context

// const invalidToken = await isJWTInvalid(req.cookies.token)
const invalidToken = true
const invalidToken = await isJWTInvalid(req.cookies.token)
// const invalidToken = true

if (invalidToken) {
cookies.remove('user', { path: '/' })
Expand Down
2 changes: 1 addition & 1 deletion next/pages/user/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function Login() {
}

const fetchToken = async ({ email, password }) => {
const result = await getToken({email: "email", password: "password"})
const result = await getToken({email: email, password: password})

if(result?.tokenAuth === null || result?.errors?.length > 0) return setErrors({login:"E-mail ou senha incorretos."})

Expand Down

0 comments on commit c400fc1

Please sign in to comment.