From 30750c17864145e46d01c732f585c5ae12d966c4 Mon Sep 17 00:00:00 2001 From: yeonddori Date: Sun, 21 Jul 2024 03:51:46 +0900 Subject: [PATCH 1/4] =?UTF-8?q?refactor:=20=EC=BD=94=EB=93=9C=20=EC=88=9C?= =?UTF-8?q?=EC=84=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #100 --- src/app/newsletter/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/newsletter/page.tsx b/src/app/newsletter/page.tsx index 3d796e4..ce609d7 100644 --- a/src/app/newsletter/page.tsx +++ b/src/app/newsletter/page.tsx @@ -21,9 +21,9 @@ const Page = () => { const [selectedTab, setSelectedTab] = useState(articleCategory[0]); const [articles, setArticles] = useState([]); const [popularArticles, setPopularArticles] = useState([]); - const [userName, setUserName] = useState(null); const user = useGetUser(); + const [userName, setUserName] = useState(null); useEffect(() => { getArticleAll().then((res) => { From c01eafb494545f0e76e2294997f3f3e178433094 Mon Sep 17 00:00:00 2001 From: yeonddori Date: Sun, 21 Jul 2024 04:16:36 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=ED=97=A4=EB=8D=94=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=95=84=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #100 --- src/components/Header.tsx | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 00ed1e0..4689052 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -2,15 +2,20 @@ import { useState, useEffect } from 'react'; -import { Button, Link, Stack, Typography, Box } from '@mui/material'; +import { Button, Link, Stack, Typography, Box, Avatar } from '@mui/material'; +import { getUser } from '@/app/api/user'; import { mainCategory } from '@/constants/category'; import color from '@/constants/color'; +import useGetUser from '@/hooks/useGetUser'; const Header = () => { const [show, setShow] = useState(true); const [lastScrollY, setLastScrollY] = useState(0); + const user = useGetUser(); + const [userProfile, setUserProfile] = useState(null); + useEffect(() => { const controlHeader = () => { if (window.scrollY > lastScrollY) { @@ -28,6 +33,18 @@ const Header = () => { }; }, [lastScrollY]); + useEffect(() => { + if (user?.isLogin) { + getUser(user.token).then((res) => { + if (res.status) { + setUserProfile(res.data.profileImage); + } else { + throw res.message; + } + }); + } + }, [user]); + return ( <> { 경제를 단순하게 - + {mainCategory.map((item) => ( { {item.label} ))} - - - - + {userProfile ? ( + + ) : ( + + + + )} From 83f2aa5148af35373f12846f3c64ac9746a069be Mon Sep 17 00:00:00 2001 From: yeonddori Date: Sun, 21 Jul 2024 04:22:59 +0900 Subject: [PATCH 3/4] =?UTF-8?q?design:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=EC=9D=BC=20=EB=95=8C=EB=A7=8C=20flex-end=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #100 --- src/components/Header.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 4689052..f58f6da 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -64,7 +64,7 @@ const Header = () => { 경제를 단순하게 - + {mainCategory.map((item) => ( Date: Sun, 21 Jul 2024 04:29:04 +0900 Subject: [PATCH 4/4] =?UTF-8?q?refactor:=20import=20=EC=88=9C=EC=84=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #100 --- src/components/Header.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index f58f6da..0c2adf0 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -2,7 +2,7 @@ import { useState, useEffect } from 'react'; -import { Button, Link, Stack, Typography, Box, Avatar } from '@mui/material'; +import { Avatar, Box, Button, Link, Stack, Typography } from '@mui/material'; import { getUser } from '@/app/api/user'; import { mainCategory } from '@/constants/category';