diff --git a/apps/frontend/components/auth/HeaderAuthPanel.tsx b/apps/frontend/components/auth/HeaderAuthPanel.tsx
index 3efe1bc4a7..7cd06db45f 100644
--- a/apps/frontend/components/auth/HeaderAuthPanel.tsx
+++ b/apps/frontend/components/auth/HeaderAuthPanel.tsx
@@ -9,15 +9,18 @@ import {
DropdownMenuItem,
DropdownMenuSeparator
} from '@/components/ui/dropdown-menu'
-import { cn } from '@/lib/utils'
+import { cn, fetcherWithAuth } from '@/lib/utils'
import useAuthModalStore from '@/stores/authModal'
import { LogOut, UserRoundCog, ChevronDown } from 'lucide-react'
import type { Session } from 'next-auth'
import { signOut } from 'next-auth/react'
import Link from 'next/link'
+import { usePathname } from 'next/navigation'
+import { useEffect, useState } from 'react'
import { BiSolidUser } from 'react-icons/bi'
import { RxHamburgerMenu } from 'react-icons/rx'
import AuthModal from './AuthModal'
+import UpdateInformation from './UpdateInformation'
interface HeaderAuthPanelProps {
session: Session | null
@@ -38,38 +41,73 @@ export default function HeaderAuthPanel({
)
const isUser = session?.user.role === 'User'
const isEditor = group === 'editor'
+ const [needsUpdate, setNeedsUpdate] = useState(false)
+ const pathname = usePathname()
+
+ useEffect(() => {
+ const checkIfNeedsUpdate = async () => {
+ const userResponse = await fetcherWithAuth.get('user')
+ const user: { studentId: string; major: string } =
+ await userResponse.json()
+ const updateNeeded =
+ user.studentId === '0000000000' ||
+ user.major === 'Department Information Unavailable / 학과 정보 없음'
+
+ setNeedsUpdate(updateNeeded)
+ }
+ if (session) {
+ checkIfNeedsUpdate()
+ }
+ }, [session])
+
+ const shouldShowDialog =
+ needsUpdate && pathname.split('/').pop() !== 'settings'
return (
{session ? (
-
-
-
+
+
- {!isEditor && (
-
- {session?.user.username}
-
- )}
-
-
-
- {!isUser && (
-
+ >
+
+ {!isEditor && (
+
+ {session?.user.username}
+
+ )}
+
+
+
+ {!isUser && (
+
+
+ Management
+
+
+ )}
+
- Management
+ Settings
- )}
-
{
+ signOut()
+ }}
>
- Settings
+ LogOut
-
- {
- signOut()
- }}
+
+
+
+ >
) : (