fix notifikasi forum
deskripsi: - fix load data notifikasi: forum
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { gs_count_ntf, gs_user_ntf } from "@/lib/global_state";
|
import { gs_user_ntf } from "@/lib/global_state";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -22,7 +22,7 @@ export default function HomeView({
|
|||||||
}) {
|
}) {
|
||||||
const [countNtf, setCountNtf] = useState(countNotifikasi);
|
const [countNtf, setCountNtf] = useState(countNotifikasi);
|
||||||
const [newUserNtf, setNewUserNtf] = useAtom(gs_user_ntf);
|
const [newUserNtf, setNewUserNtf] = useAtom(gs_user_ntf);
|
||||||
const [countLoadNtf, setCountLoadNtf] = useAtom(gs_count_ntf);
|
// const [countLoadNtf, setCountLoadNtf] = useAtom(gs_count_ntf);
|
||||||
const userRoleId = dataUser.masterUserRoleId;
|
const userRoleId = dataUser.masterUserRoleId;
|
||||||
|
|
||||||
// useShallowEffect(() => {
|
// useShallowEffect(() => {
|
||||||
@@ -33,15 +33,15 @@ export default function HomeView({
|
|||||||
// }
|
// }
|
||||||
// }, [userRoleId]);
|
// }, [userRoleId]);
|
||||||
|
|
||||||
useShallowEffect(() => {
|
// useShallowEffect(() => {
|
||||||
onLoadNotifikasi({
|
// onLoadNotifikasi({
|
||||||
onLoad(val) {
|
// onLoad(val) {
|
||||||
setCountNtf(val);
|
// setCountNtf(val);
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
|
||||||
setCountNtf(countLoadNtf as any);
|
// setCountNtf(countLoadNtf as any);
|
||||||
}, [countLoadNtf, setCountNtf]);
|
// }, [countLoadNtf, setCountNtf]);
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
setCountNtf(countNtf + newUserNtf);
|
setCountNtf(countNtf + newUserNtf);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { gs_count_ntf, gs_user_ntf } from "@/lib/global_state";
|
import { gs_user_ntf } from "@/lib/global_state";
|
||||||
import global_limit from "@/lib/limit";
|
import global_limit from "@/lib/limit";
|
||||||
import { RouterProfile } from "@/lib/router_hipmi/router_katalog";
|
import { RouterProfile } from "@/lib/router_hipmi/router_katalog";
|
||||||
import { RouterNotifikasi } from "@/lib/router_hipmi/router_notifikasi";
|
import { RouterNotifikasi } from "@/lib/router_hipmi/router_notifikasi";
|
||||||
@@ -20,7 +20,7 @@ import FooterHome from "./component/footer_home";
|
|||||||
import { apiGetDataHome, apiGetNotifikasiHome } from "./fun/get/api_home";
|
import { apiGetDataHome, apiGetNotifikasiHome } from "./fun/get/api_home";
|
||||||
|
|
||||||
export default function HomeViewNew() {
|
export default function HomeViewNew() {
|
||||||
const [countNtf, setCountNtf] = useAtom(gs_count_ntf);
|
const [countNtf, setCountNtf] = useState<number | null>(null);
|
||||||
const [newUserNtf, setNewUserNtf] = useAtom(gs_user_ntf);
|
const [newUserNtf, setNewUserNtf] = useAtom(gs_user_ntf);
|
||||||
const [dataUser, setDataUser] = useState<any | null>(null);
|
const [dataUser, setDataUser] = useState<any | null>(null);
|
||||||
const [categoryPage, setCategoryPage] = useAtom(gs_notifikasi_kategori_app);
|
const [categoryPage, setCategoryPage] = useAtom(gs_notifikasi_kategori_app);
|
||||||
@@ -31,7 +31,7 @@ export default function HomeViewNew() {
|
|||||||
setCountNtf(countNtf + newUserNtf);
|
setCountNtf(countNtf + newUserNtf);
|
||||||
setNewUserNtf(0);
|
setNewUserNtf(0);
|
||||||
}
|
}
|
||||||
}, [newUserNtf, countNtf]);
|
}, [newUserNtf]);
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
hanlderLoadData();
|
hanlderLoadData();
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { gs_event_hotMenu } from "@/app_modules/event/global_state";
|
|||||||
import { gs_investas_menu } from "@/app_modules/investasi/g_state";
|
import { gs_investas_menu } from "@/app_modules/investasi/g_state";
|
||||||
import { gs_job_hot_menu } from "@/app_modules/job/global_state";
|
import { gs_job_hot_menu } from "@/app_modules/job/global_state";
|
||||||
import { gs_vote_hotMenu } from "@/app_modules/vote/global_state";
|
import { gs_vote_hotMenu } from "@/app_modules/vote/global_state";
|
||||||
import { gs_count_ntf } from "@/lib/global_state";
|
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
import { Badge, Card, Divider, Group, Stack, Text } from "@mantine/core";
|
import { Badge, Card, Divider, Group, Stack, Text } from "@mantine/core";
|
||||||
import { IconCheck, IconChecks } from "@tabler/icons-react";
|
import { IconCheck, IconChecks } from "@tabler/icons-react";
|
||||||
@@ -22,10 +21,10 @@ import { useState } from "react";
|
|||||||
import { MODEL_NOTIFIKASI } from "../model/interface";
|
import { MODEL_NOTIFIKASI } from "../model/interface";
|
||||||
import { redirectDonasiPage } from "./path/donasi";
|
import { redirectDonasiPage } from "./path/donasi";
|
||||||
import { notifikasi_eventCheckStatus } from "./path/event";
|
import { notifikasi_eventCheckStatus } from "./path/event";
|
||||||
|
import { redirectDetailForumPage } from "./path/forum";
|
||||||
import { redirectInvestasiPage } from "./path/investasi";
|
import { redirectInvestasiPage } from "./path/investasi";
|
||||||
import { notifikasi_jobCheckStatus } from "./path/job";
|
import { notifikasi_jobCheckStatus } from "./path/job";
|
||||||
import { notifikasi_votingCheckStatus } from "./path/voting";
|
import { notifikasi_votingCheckStatus } from "./path/voting";
|
||||||
import { redirectDetailForumPage } from "./path/forum";
|
|
||||||
|
|
||||||
export function ComponentNotifiaksi_CardView({
|
export function ComponentNotifiaksi_CardView({
|
||||||
data,
|
data,
|
||||||
@@ -34,7 +33,6 @@ export function ComponentNotifiaksi_CardView({
|
|||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [loadCountNtf, setLoadCountNtf] = useAtom(gs_count_ntf);
|
|
||||||
|
|
||||||
const [jobMenuId, setJobMenuId] = useAtom(gs_job_hot_menu);
|
const [jobMenuId, setJobMenuId] = useAtom(gs_job_hot_menu);
|
||||||
const [eventMenuId, setEventMenuId] = useAtom(gs_event_hotMenu);
|
const [eventMenuId, setEventMenuId] = useAtom(gs_event_hotMenu);
|
||||||
@@ -59,8 +57,8 @@ export function ComponentNotifiaksi_CardView({
|
|||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
try {
|
try {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
|
||||||
console.log("data", data);
|
console.log("data", data);
|
||||||
|
|
||||||
// JOB
|
// JOB
|
||||||
if (data?.kategoriApp === "JOB") {
|
if (data?.kategoriApp === "JOB") {
|
||||||
await notifikasi_jobCheckStatus({
|
await notifikasi_jobCheckStatus({
|
||||||
@@ -114,7 +112,7 @@ export function ComponentNotifiaksi_CardView({
|
|||||||
|
|
||||||
// DONASI
|
// DONASI
|
||||||
if (data?.kategoriApp === "DONASI") {
|
if (data?.kategoriApp === "DONASI") {
|
||||||
redirectDonasiPage({
|
await redirectDonasiPage({
|
||||||
appId: data.appId,
|
appId: data.appId,
|
||||||
dataId: data.id,
|
dataId: data.id,
|
||||||
userId: data.userId,
|
userId: data.userId,
|
||||||
@@ -132,7 +130,7 @@ export function ComponentNotifiaksi_CardView({
|
|||||||
|
|
||||||
// INVESTASI
|
// INVESTASI
|
||||||
if (data?.kategoriApp === "INVESTASI") {
|
if (data?.kategoriApp === "INVESTASI") {
|
||||||
redirectInvestasiPage({
|
await redirectInvestasiPage({
|
||||||
appId: data.appId,
|
appId: data.appId,
|
||||||
dataId: data.id,
|
dataId: data.id,
|
||||||
router: router,
|
router: router,
|
||||||
@@ -148,7 +146,7 @@ export function ComponentNotifiaksi_CardView({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data?.kategoriApp === "FORUM") {
|
if (data?.kategoriApp === "FORUM") {
|
||||||
redirectDetailForumPage({
|
await redirectDetailForumPage({
|
||||||
data: data,
|
data: data,
|
||||||
router: router,
|
router: router,
|
||||||
onSetVisible(val) {
|
onSetVisible(val) {
|
||||||
|
|||||||
Reference in New Issue
Block a user