Fix: Middlerawe/6
This commit is contained in:
@@ -44,11 +44,12 @@ export default async function RootLayout({
|
||||
// if (!token) return <>Require Token Storage</>;
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
|
||||
return (
|
||||
<RootStyleRegistry>
|
||||
{/* <MqttLoader />
|
||||
<TokenProvider token={token} envObject={envObject} /> */}
|
||||
{/* <RealtimeProvider userLoginId={userLoginId as string} /> */}
|
||||
<RealtimeProvider userLoginId={userLoginId as string} />
|
||||
{children}
|
||||
</RootStyleRegistry>
|
||||
);
|
||||
|
||||
@@ -23,7 +23,8 @@ export type TypeNotification = {
|
||||
userLoginId?: string;
|
||||
};
|
||||
|
||||
const WIBU_REALTIME_TOKEN: any = process.env.NEXT_PUBLIC_WIBU_REALTIME_TOKEN;
|
||||
const WIBU_REALTIME_TOKEN: string | undefined =
|
||||
process.env.NEXT_PUBLIC_WIBU_REALTIME_TOKEN;
|
||||
export default function RealtimeProvider({
|
||||
userLoginId,
|
||||
}: {
|
||||
@@ -57,9 +58,14 @@ export default function RealtimeProvider({
|
||||
);
|
||||
|
||||
useShallowEffect(() => {
|
||||
if (WIBU_REALTIME_TOKEN === undefined) return alert("gak dapet key");
|
||||
try {
|
||||
WibuRealtime.init({
|
||||
onData(data: TypeNotification) {
|
||||
if (data.type == "notification" && data.pushNotificationTo == "ADMIN") {
|
||||
if (
|
||||
data.type == "notification" &&
|
||||
data.pushNotificationTo == "ADMIN"
|
||||
) {
|
||||
setNewAdminNtf((e) => e + 1);
|
||||
}
|
||||
|
||||
@@ -152,6 +158,9 @@ export default function RealtimeProvider({
|
||||
project: "hipmi",
|
||||
WIBU_REALTIME_TOKEN: WIBU_REALTIME_TOKEN,
|
||||
});
|
||||
} catch (error) {
|
||||
alert("error realtime");
|
||||
}
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user