fix notifikasi
deskripsi: - fix load data notifikasi: semua, event, job, donasi, investasi
This commit is contained in:
@@ -1,26 +1,46 @@
|
||||
import { RouterForum } from "@/lib/router_hipmi/router_forum";
|
||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
import { MODEL_NOTIFIKASI } from "../../model/interface";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global";
|
||||
import notifikasi_funUpdateIsReadById from "../../fun/update/fun_update_is_read_by_user_id";
|
||||
|
||||
export function redirectDetailForumPage({
|
||||
export async function redirectDetailForumPage({
|
||||
data,
|
||||
router,
|
||||
onSetVisible,
|
||||
}: {
|
||||
data: MODEL_NOTIFIKASI;
|
||||
router: AppRouterInstance;
|
||||
onSetVisible(val: boolean): void;
|
||||
}) {
|
||||
if (data.status === null) {
|
||||
const path = RouterForum.main_detail + data.appId;
|
||||
router.push(path, { scroll: false });
|
||||
}
|
||||
try {
|
||||
if (data.status === null) {
|
||||
const path = RouterForum.main_detail + data.appId;
|
||||
router.push(path, { scroll: false });
|
||||
}
|
||||
|
||||
if (data.status === "Report Komentar") {
|
||||
const path = RouterForum.detail_report_komentar + data.appId;
|
||||
router.push(path, { scroll: false });
|
||||
}
|
||||
if (data.status === "Report Komentar") {
|
||||
const path = RouterForum.detail_report_komentar + data.appId;
|
||||
router.push(path, { scroll: false });
|
||||
}
|
||||
|
||||
if (data.status === "Report Posting") {
|
||||
const path = RouterForum.detail_report_posting + data.appId;
|
||||
router.push(path, { scroll: false });
|
||||
if (data.status === "Report Posting") {
|
||||
const path = RouterForum.detail_report_posting + data.appId;
|
||||
router.push(path, { scroll: false });
|
||||
}
|
||||
|
||||
const updateReadNotifikasi = await notifikasi_funUpdateIsReadById({
|
||||
notifId: data.id,
|
||||
});
|
||||
|
||||
if (updateReadNotifikasi.status == 200) {
|
||||
onSetVisible(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error("Error get all forum :", error);
|
||||
ComponentGlobal_NotifikasiPeringatan("Status tidak ditemukan");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user