upd: pengumuman
Deskripsi: - update realtime tambah pengumuman pake yg refresh page No Issues
This commit is contained in:
@@ -5,7 +5,7 @@ import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useWibuRealtime } from "wibu-realtime";
|
||||
import NotificationCustome from "./notification_custome";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import { globalParamJumlahNotif } from "@/module/home";
|
||||
import ReloadButtonTop from "./reload_button_top";
|
||||
|
||||
@@ -20,6 +20,8 @@ export default function WrapLayout({ children, role, theme, user }: { children:
|
||||
WIBU_REALTIME_TOKEN: keyWibu,
|
||||
project: "sdm"
|
||||
})
|
||||
const path = usePathname()
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
roleLogin.set(role)
|
||||
@@ -29,11 +31,18 @@ export default function WrapLayout({ children, role, theme, user }: { children:
|
||||
|
||||
useShallowEffect(() => {
|
||||
if (data && data.some((i: any) => i.idUserTo == user)) {
|
||||
setTampilNotif(true)
|
||||
paramNotif.set(!paramNotif.get())
|
||||
setTimeout(() => {
|
||||
setTampilNotif(false);
|
||||
}, 4000);
|
||||
if (data.some((i: any) => i.category == path.substring(1))) {
|
||||
notifLoadPage.set({
|
||||
category: path.substring(1),
|
||||
load: true
|
||||
})
|
||||
} else {
|
||||
setTampilNotif(true)
|
||||
paramNotif.set(!paramNotif.get())
|
||||
setTimeout(() => {
|
||||
setTampilNotif(false);
|
||||
}, 4000);
|
||||
}
|
||||
}
|
||||
}, [data])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user