|
|
@ -1,6 +1,5 @@
|
|
|
|
'use client';
|
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
|
|
import { parseCookies } from 'nookies';
|
|
|
|
|
|
|
|
import { useShallow } from 'zustand/react/shallow';
|
|
|
|
import { useShallow } from 'zustand/react/shallow';
|
|
|
|
|
|
|
|
|
|
|
|
import HeaderAvatar from './HeaderAvatar';
|
|
|
|
import HeaderAvatar from './HeaderAvatar';
|
|
|
@ -9,9 +8,9 @@ import { LoginModal } from '@/components';
|
|
|
|
import useUserStore from '@/store/user';
|
|
|
|
import useUserStore from '@/store/user';
|
|
|
|
|
|
|
|
|
|
|
|
export default function Auth() {
|
|
|
|
export default function Auth() {
|
|
|
|
const { token } = parseCookies();
|
|
|
|
const { userInfo, showLogin, setShowLogin } = useUserStore(
|
|
|
|
const { showLogin, setShowLogin } = useUserStore(
|
|
|
|
|
|
|
|
useShallow((state) => ({
|
|
|
|
useShallow((state) => ({
|
|
|
|
|
|
|
|
userInfo: state.userInfo,
|
|
|
|
showLogin: state.showLogin,
|
|
|
|
showLogin: state.showLogin,
|
|
|
|
setShowLogin: state.setShowLogin,
|
|
|
|
setShowLogin: state.setShowLogin,
|
|
|
|
})),
|
|
|
|
})),
|
|
|
@ -19,17 +18,15 @@ export default function Auth() {
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
{!!token ? (
|
|
|
|
{!!userInfo.id ? (
|
|
|
|
<HeaderAvatar className="ml-[40px]" />
|
|
|
|
<HeaderAvatar className="ml-[40px]" />
|
|
|
|
) : (
|
|
|
|
) : (
|
|
|
|
<div>
|
|
|
|
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
className="w-[74px] h-[36px] ml-[40px] border-[#000] border-[1.5px] rounded-[60px] text-[17px] hover:bg-brand hover:border-brand hover:text-[#fff] "
|
|
|
|
className="w-[74px] h-[36px] ml-[40px] border-[#000] border-[1.5px] rounded-[60px] text-[17px] hover:bg-brand hover:border-brand hover:text-[#fff] "
|
|
|
|
onClick={() => setShowLogin(true)}
|
|
|
|
onClick={() => setShowLogin(true)}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
登录
|
|
|
|
登录
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
{/* 登录框 */}
|
|
|
|
{/* 登录框 */}
|
|
|
|
{showLogin && <LoginModal />}
|
|
|
|
{showLogin && <LoginModal />}
|
|
|
|