fix: API param localStorge useId
Change-Id: Ifd624462360111f08ca308ea07b6fcaac0747104
diff --git a/src/app/notification/page.tsx b/src/app/notification/page.tsx
index 9e83252..55f0ec5 100644
--- a/src/app/notification/page.tsx
+++ b/src/app/notification/page.tsx
@@ -11,9 +11,11 @@
import { Paginator, PaginatorPageChangeEvent } from 'primereact/paginator';
import { Card } from 'primereact/card';
import { TabView, TabPanel } from 'primereact/tabview'; // ✅ TabView 导入
-
+import { useLocalStorage } from '../hook/useLocalStorage';
import './notification.scss';
-
+interface User {
+ Id: number;
+}
interface Notification {
notificationId: number;
title: string;
@@ -25,6 +27,8 @@
}
export default function NotificationPage() {
+ const user = useLocalStorage<User>('user');
+ const userId: number = user?.Id ?? -1;
const toast = useRef<Toast>(null);
const [notifications, setNotifications] = useState<Notification[]>([]);
const [selectedNotification, setSelectedNotification] = useState<Notification | null>(null);
@@ -41,7 +45,7 @@
try {
const pageNumber = first / rows + 1;
const res = await axios.get(process.env.PUBLIC_URL + '/notification', {
- params: { pageNumber, rows, userId: 22301145 },
+ params: { pageNumber, rows, userId },
});
const { records, total } = res.data;
setNotifications(records);