roles update
This commit is contained in:
@@ -63,6 +63,9 @@ export function NotificationBell() {
|
||||
if (event.type === 'family_invite') {
|
||||
showToast(event.message || 'Новое приглашение в семью');
|
||||
}
|
||||
if (event.type === 'role_assigned' || event.type === 'role_removed') {
|
||||
showToast(event.message || 'Изменение ролей');
|
||||
}
|
||||
});
|
||||
}, [load, showToast, subscribe]);
|
||||
|
||||
@@ -80,6 +83,11 @@ export function NotificationBell() {
|
||||
if (payload.groupId) {
|
||||
setOpen(false);
|
||||
router.push(`/family/${payload.groupId}`);
|
||||
return;
|
||||
}
|
||||
if (item.type === 'role_assigned' || item.type === 'role_removed') {
|
||||
setOpen(false);
|
||||
router.push('/admin');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,12 @@ export function RealtimeProvider({ children }: { children: React.ReactNode }) {
|
||||
try {
|
||||
const data = JSON.parse(event.data as string) as RealtimeEvent;
|
||||
emit(data);
|
||||
if (data.type === 'family_invite' || (data.type === 'chat_message' && data.payload?.notificationId)) {
|
||||
if (
|
||||
data.type === 'family_invite' ||
|
||||
data.type === 'role_assigned' ||
|
||||
data.type === 'role_removed' ||
|
||||
(data.type === 'chat_message' && data.payload?.notificationId)
|
||||
) {
|
||||
setUnreadCount((count) => count + 1);
|
||||
}
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user