fix: API param localStorge useId

Change-Id: Ifd624462360111f08ca308ea07b6fcaac0747104
diff --git a/src/app/hook/useLocalStorage.ts b/src/app/hook/useLocalStorage.ts
new file mode 100644
index 0000000..2b28b01
--- /dev/null
+++ b/src/app/hook/useLocalStorage.ts
@@ -0,0 +1,20 @@
+import { useEffect, useState } from 'react';
+
+export const useLocalStorage = <T>(key: string): T | null => {
+  const [value, setValue] = useState<T | null>(null);
+
+  useEffect(() => {
+    if (typeof window !== 'undefined') {
+      const item = localStorage.getItem(key);
+      if (item) {
+        try {
+          setValue(JSON.parse(item));
+        } catch (e) {
+          console.error(`解析 localStorage ${key} 失败`, e);
+        }
+      }
+    }
+  }, [key]);
+
+  return value;
+};