diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 2acdf8a..05c8b57 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -3,7 +3,7 @@ import Script from 'next/script';
import { Toaster } from '@/components/ui/toaster';
-import { Header, Footer, PlayerBar, ScrollTopButton } from '@/components';
+import { Header, App, Footer, PlayerBar, ScrollTopButton } from '@/components';
import './globals.css';
@@ -31,6 +31,7 @@ export default function RootLayout({ children }: Readonly<{ children: React.Reac
return (
+
{children}
diff --git a/src/components/App.tsx b/src/components/App.tsx
new file mode 100644
index 0000000..730e59b
--- /dev/null
+++ b/src/components/App.tsx
@@ -0,0 +1,21 @@
+'use client';
+
+import { useEffect } from 'react';
+
+import { useShallow } from 'zustand/react/shallow';
+
+import { useUserStore } from '@/store';
+
+export default function APP() {
+ const { getUserInfo } = useUserStore(
+ useShallow((state) => ({
+ getUserInfo: state.getUserInfo,
+ })),
+ );
+
+ useEffect(() => {
+ getUserInfo();
+ }, []);
+
+ return ;
+}
diff --git a/src/components/Header/Auth.tsx b/src/components/Header/Auth.tsx
index ba23a45..c5e0cc8 100644
--- a/src/components/Header/Auth.tsx
+++ b/src/components/Header/Auth.tsx
@@ -13,8 +13,6 @@ export default function Auth() {
const { userInfo } = useUserStore(
useShallow((state) => ({
userInfo: state.userInfo,
- showLogin: state.showLogin,
- setShowLogin: state.setShowLogin,
})),
);
diff --git a/src/components/index.ts b/src/components/index.ts
index c08188e..6ac7051 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -1,3 +1,4 @@
+export { default as App } from './App';
export { default as Logo } from './Logo';
export { default as Header } from './Header/Header';
export { default as Footer } from './Footer/Footer';
diff --git a/src/store/user.ts b/src/store/user.ts
index ea5302c..5598eb3 100644
--- a/src/store/user.ts
+++ b/src/store/user.ts
@@ -1,3 +1,8 @@
+/**
+ * 这里需要改一下,最好能在初始化的时候刷新一次 UserInfo
+ * https://github.com/pmndrs/zustand/blob/main/docs/integrations/persisting-store-data.md#usage-in-nextjs
+ */
+
import { produce } from 'immer';
// import { setCookie } from 'nookies';
import { create } from 'zustand';