rename content into message for notifications
This commit is contained in:
1 parent
ef30e27ad7
commit
d23fd55134
3 files changed
+10
-8
No files matched your search
@@ -40,7 +40,7 @@ function Header() {
|
|||||||
|
|
||||||
const data: Notification[] = notifData || [];
|
const data: Notification[] = notifData || [];
|
||||||
setNotifications(data);
|
setNotifications(data);
|
||||||
const hasUnread = data.some(n => n.pivot && n.pivot.unread === 1);
|
const hasUnread = data.some(n => n.read_at === null);
|
||||||
setunreadNotification(hasUnread);
|
setunreadNotification(hasUnread);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Erreur initialisation Header:", err);
|
console.error("Erreur initialisation Header:", err);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Notification from "../../interfaces/notification.interface";
|
|||||||
|
|
||||||
interface NotificationCardProps {
|
interface NotificationCardProps {
|
||||||
notifications: Notification[];
|
notifications: Notification[];
|
||||||
deleteNotification: (id: number) => void;
|
deleteNotification: (id: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function NotificationCard({ notifications, deleteNotification }: NotificationCardProps) {
|
function NotificationCard({ notifications, deleteNotification }: NotificationCardProps) {
|
||||||
@@ -25,9 +25,9 @@ function NotificationCard({ notifications, deleteNotification }: NotificationCar
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.cardContent}>
|
<div>
|
||||||
<p className={styles.message}>
|
<p className={styles.message}>
|
||||||
{notification.content}
|
{notification.data.message}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
export default interface Notification {
|
export default interface Notification {
|
||||||
id: number;
|
id: string;s
|
||||||
content: string;
|
data: {
|
||||||
created_at: string | number;
|
message: string;
|
||||||
pivot: { unread: number };
|
};
|
||||||
|
read_at: string | null;
|
||||||
|
created_at: string;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user