Fix build and run issues
This commit is contained in:
@@ -213,7 +213,7 @@ export interface Notification {
|
||||
id: number;
|
||||
volunteer_id: number;
|
||||
message: string;
|
||||
read: boolean;
|
||||
is_read: boolean;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ export default function Dashboard() {
|
||||
async function handleMarkRead(id: number) {
|
||||
try {
|
||||
await api.markRead(id);
|
||||
setNotifications(prev => prev.map(n => n.id === id ? { ...n, read: true } : n));
|
||||
setNotifications(prev => prev.map(n => n.id === id ? { ...n, is_read: true } : n));
|
||||
} catch {}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export default function Dashboard() {
|
||||
.filter(s => new Date(s.date) >= now)
|
||||
.slice(0, 5);
|
||||
|
||||
const unreadNotifications = notifications.filter(n => !n.read);
|
||||
const unreadNotifications = notifications.filter(n => !n.is_read);
|
||||
|
||||
return (
|
||||
<div className="page">
|
||||
@@ -93,9 +93,9 @@ export default function Dashboard() {
|
||||
) : (
|
||||
<ul>
|
||||
{notifications.map(n => (
|
||||
<li key={n.id} className={n.read ? 'read' : 'unread'}>
|
||||
<li key={n.id} className={n.is_read ? 'read' : 'unread'}>
|
||||
{n.message}
|
||||
{!n.read && (
|
||||
{!n.is_read && (
|
||||
<button className="btn-small" onClick={() => handleMarkRead(n.id)}>Mark read</button>
|
||||
)}
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user