fix: mqtt
Deskripsi: - hapus package mqtt No Issues
This commit is contained in:
@@ -5,7 +5,6 @@ import moment from "moment";
|
||||
import "moment/locale/id";
|
||||
import { NextResponse } from "next/server";
|
||||
import { createLogUser } from '@/module/user';
|
||||
import mtqq_client from "../../../module/_global/bin/mqtt_client";
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
@@ -201,22 +200,6 @@ export async function POST(request: Request) {
|
||||
data: dataNotif
|
||||
})
|
||||
|
||||
// for (let index = 0; index < dataNotif.length; index++) {
|
||||
|
||||
// const user = dataNotif[index].idUserTo
|
||||
// const title = dataNotif[index].title
|
||||
// const desc = dataNotif[index].desc
|
||||
|
||||
|
||||
// mtqq_client.publish("app_SDM", JSON.stringify({
|
||||
// "user": "clzm6swhg000tfgbhm3bau9ti",
|
||||
// "title": title,
|
||||
// "category": "announcement",
|
||||
// "description": desc
|
||||
// }))
|
||||
// }
|
||||
|
||||
|
||||
// create log user
|
||||
const log = await createLogUser({ act: 'CREATE', desc: 'User membuat data pengumuman baru', table: 'announcement', data: data.id })
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import mtqq from 'mqtt'
|
||||
|
||||
declare global {
|
||||
var mtqq_client: mtqq.MqttClient
|
||||
}
|
||||
|
||||
const mtqq_client = globalThis.mtqq_client ?? mtqq.connect("wss://io.wibudev.com")
|
||||
|
||||
export default mtqq_client
|
||||
@@ -1,18 +0,0 @@
|
||||
'use client'
|
||||
import { useEffect } from "react"
|
||||
import mtqq_client from "./mqtt_client"
|
||||
|
||||
export default function MqttLoad() {
|
||||
useEffect(() => {
|
||||
mtqq_client.on("connect", () => {
|
||||
mtqq_client.subscribe("app_SDM")
|
||||
})
|
||||
|
||||
mtqq_client.on("message", (topic, message) => {
|
||||
const data = JSON.parse(message.toString())
|
||||
})
|
||||
}, [])
|
||||
return <>
|
||||
|
||||
</>
|
||||
}
|
||||
@@ -3,7 +3,6 @@ import { useHookstate } from "@hookstate/core";
|
||||
import { globalNotifPage, globalRole, TEMA } from "../bin/val_global";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useEffect } from "react";
|
||||
import mtqq_client from "../bin/mqtt_client";
|
||||
|
||||
export default function WrapLayout({ children, role, theme, user }: { children: React.ReactNode, role: any, theme: any, user: any }) {
|
||||
const roleLogin = useHookstate(globalRole)
|
||||
@@ -16,27 +15,6 @@ export default function WrapLayout({ children, role, theme, user }: { children:
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [role, theme])
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
mtqq_client.on("connect", () => {
|
||||
console.log('connect layout')
|
||||
mtqq_client.subscribe("app_SDM")
|
||||
})
|
||||
|
||||
mtqq_client.on("message", (topic, message) => {
|
||||
const data = JSON.parse(message.toString())
|
||||
|
||||
console.log('notif mtqq',data)
|
||||
|
||||
// console.log('notif mtqq==',data)
|
||||
// if (data.user == user) {
|
||||
// notifLoadPage.set({
|
||||
// load: !notifLoadPage.get(),
|
||||
// category: data.category
|
||||
// })
|
||||
// }
|
||||
})
|
||||
})
|
||||
return (
|
||||
<>
|
||||
{children}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import MqttLoad from "./bin/mqtt_load";
|
||||
import prisma from "./bin/prisma";
|
||||
import { currentScroll, DIR, globalNotifPage, globalRole, pwd_key_config, TEMA } from "./bin/val_global";
|
||||
import SkeletonAvatar from "./components/skeleton_avatar";
|
||||
@@ -22,7 +21,6 @@ import LayoutNavbarNew from "./layout/layout_navbar_new";
|
||||
import NoZoom from "./layout/no_zoom";
|
||||
import ReloadButtonTop from "./components/reload_button_top";
|
||||
import ViewFilter from "./view/view_filter";
|
||||
import mtqq_client from "./bin/mqtt_client"
|
||||
import NotificationCustome from "./components/notification_custome";
|
||||
import { ScrollProvider } from "./components/scroll_provider";
|
||||
import SkeletonUser from "./components/skeleton_user";
|
||||
@@ -52,8 +50,6 @@ export { funDeleteFile }
|
||||
export { DIR }
|
||||
export { TEMA }
|
||||
export { funCopyFile }
|
||||
export { MqttLoad }
|
||||
export { mtqq_client }
|
||||
export { globalNotifPage }
|
||||
export { SkeletonAvatar }
|
||||
export { ReloadButtonTop }
|
||||
|
||||
Reference in New Issue
Block a user