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