Skip to content

Commit

Permalink
Merge pull request #231 from GAMZA-BAT/main
Browse files Browse the repository at this point in the history
[ Deploy ] v0.4.1 데이터 패칭 오류 해결
  • Loading branch information
j-nary authored Nov 27, 2024
2 parents 715657e + 7404f1f commit 9fe3f89
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
24 changes: 24 additions & 0 deletions src/shared/component/Header/Logo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"use client";

import type { UserResponse } from "@/api/users/type";
import { IcnLogo } from "@/asset/svg";
import { logoContainer, logoStyle } from "@/shared/component/Header/index.css";
import Link from "next/link";

type LogoProps = {
user: UserResponse;
};

const Logo = ({ user }: LogoProps) => {
return (
<Link
href={`/${user.nickname}`}
className={logoContainer}
aria-label="User page"
>
<IcnLogo className={logoStyle} aria-label="algoHub 로고" />
</Link>
);
};

export default Logo;
23 changes: 5 additions & 18 deletions src/shared/component/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
"use client";

import { getNotificationList } from "@/api/notifications";
import { useMyNicknameQuery } from "@/app/[user]/query";
import { IcnLogo } from "@/asset/svg";
import { getMyInfo } from "@/api/users";
import Logo from "@/shared/component/Header/Logo";
import UserMenu from "@/shared/component/Header/UserMenu";
import {
headerStyle,
logoContainer,
logoStyle,
} from "@/shared/component/Header/index.css";
import { headerStyle } from "@/shared/component/Header/index.css";
import LoginMenu from "@/view/login/LoginMenu/LoginMenu";
import {
HydrationBoundary,
QueryClient,
dehydrate,
} from "@tanstack/react-query";
import Link from "next/link";

const Header = async () => {
/* TODO: 로그인 api 부착 후 Atom으로 교체 */
// const { isLoggedIn } = useAtomValue(authAtom);
const isLoggedIn = true;
const userNickname = useMyNicknameQuery();
const userNickname = await getMyInfo();

const queryClient = new QueryClient();

Expand All @@ -32,13 +25,7 @@ const Header = async () => {

return (
<header className={headerStyle}>
<Link
href={`/${userNickname}`}
className={logoContainer}
aria-label="User page"
>
<IcnLogo className={logoStyle} aria-label="algoHub 로고" />
</Link>
<Logo user={userNickname} />
<HydrationBoundary state={dehydrate(queryClient)}>
{isLoggedIn ? <UserMenu /> : <LoginMenu />}
</HydrationBoundary>
Expand Down

0 comments on commit 9fe3f89

Please sign in to comment.