feat: update send activity logs

This commit is contained in:
hanif salafi 2025-04-24 15:43:49 +07:00
parent 4e71b4525e
commit 4b25f95f27
15 changed files with 50 additions and 25 deletions

View File

@ -16,6 +16,7 @@ import { checkMaliciousText, getPublicLocaleTimestamp } from "@/utils/globals";
import withReactContent from "sweetalert2-react-content"; import withReactContent from "sweetalert2-react-content";
import Swal from "sweetalert2"; import Swal from "sweetalert2";
import parse from "html-react-parser"; import parse from "html-react-parser";
import { postActivityLog } from "@/service/content/content";
const DetailAudio = () => { const DetailAudio = () => {
@ -47,6 +48,7 @@ const DetailAudio = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -131,8 +133,7 @@ const DetailAudio = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); await postActivityLog(data);
// console.log(response);
} }
const handleDownload = () => { const handleDownload = () => {

View File

@ -20,6 +20,7 @@ import { Button } from "@/components/ui/button";
import { useSearchParams } from "next/navigation"; import { useSearchParams } from "next/navigation";
import { sendMediaUploadToEmail } from "@/service/media-tracking/media-tracking"; import { sendMediaUploadToEmail } from "@/service/media-tracking/media-tracking";
import parse from "html-react-parser"; import parse from "html-react-parser";
import { postActivityLog } from "@/service/content/content";
const DetailDocument = () => { const DetailDocument = () => {
const [selectedSize, setSelectedSize] = useState<string>("L"); const [selectedSize, setSelectedSize] = useState<string>("L");
@ -59,6 +60,7 @@ const DetailDocument = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -151,8 +153,7 @@ const DetailDocument = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); await postActivityLog(data);
// console.log(response);
} }
const handleDownload = () => { const handleDownload = () => {

View File

@ -17,6 +17,7 @@ import withReactContent from "sweetalert2-react-content";
import Swal from "sweetalert2"; import Swal from "sweetalert2";
import { useSearchParams } from "next/navigation"; import { useSearchParams } from "next/navigation";
import parse from "html-react-parser"; import parse from "html-react-parser";
import { postActivityLog } from "@/service/content/content";
const DetailInfo = () => { const DetailInfo = () => {
const MySwal = withReactContent(Swal); const MySwal = withReactContent(Swal);
@ -57,6 +58,7 @@ const DetailInfo = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -155,8 +157,7 @@ const DetailInfo = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); await postActivityLog(data);
// console.log(response);
} }
function addDefaultProfile(ev: any) { function addDefaultProfile(ev: any) {

View File

@ -11,6 +11,7 @@ import { Textarea } from "@/components/ui/textarea";
import { getCookiesDecrypt } from "@/lib/utils"; import { getCookiesDecrypt } from "@/lib/utils";
import { close, error, loading } from "@/config/swal"; import { close, error, loading } from "@/config/swal";
import { useToast } from "@/components/ui/use-toast"; import { useToast } from "@/components/ui/use-toast";
import { postActivityLog } from "@/service/content/content";
const DetailVideo = () => { const DetailVideo = () => {
const [selectedSize, setSelectedSize] = useState<string>("L"); const [selectedSize, setSelectedSize] = useState<string>("L");
@ -34,6 +35,7 @@ const DetailVideo = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -126,8 +128,7 @@ const DetailVideo = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); await postActivityLog(data);
// console.log(response);
} }
const handleDownload = () => { const handleDownload = () => {

View File

@ -160,6 +160,7 @@ import parse from "html-react-parser";
import { Skeleton } from "@/components/ui/skeleton"; import { Skeleton } from "@/components/ui/skeleton";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import Image from "next/image"; import Image from "next/image";
import { postActivityLog } from "@/service/content/content";
interface Size { interface Size {
label: string; label: string;
@ -215,6 +216,7 @@ const DetailInfo = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -333,8 +335,7 @@ const DetailInfo = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); await postActivityLog(data);
// console.log(response);
} }
const handleDownload = () => { const handleDownload = () => {

View File

@ -11,6 +11,7 @@ import { useToast } from "@/components/ui/use-toast";
import { checkWishlistStatus, deleteWishlist, getDetail, saveWishlist } from "@/service/landing/landing"; import { checkWishlistStatus, deleteWishlist, getDetail, saveWishlist } from "@/service/landing/landing";
import { getCookiesDecrypt } from "@/lib/utils"; import { getCookiesDecrypt } from "@/lib/utils";
import { close, error, loading } from "@/config/swal"; import { close, error, loading } from "@/config/swal";
import { postActivityLog } from "@/service/content/content";
const DetailAudio = () => { const DetailAudio = () => {
const [selectedSize, setSelectedSize] = useState<string>("L"); const [selectedSize, setSelectedSize] = useState<string>("L");
@ -35,6 +36,7 @@ const DetailAudio = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -119,8 +121,7 @@ const DetailAudio = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); await postActivityLog(data);
// console.log(response);
} }
const handleDownload = () => { const handleDownload = () => {

View File

@ -10,6 +10,7 @@ import { checkWishlistStatus, deleteWishlist, getDetail, saveWishlist } from "@/
import { close, error, loading } from "@/config/swal"; import { close, error, loading } from "@/config/swal";
import { useToast } from "@/components/ui/use-toast"; import { useToast } from "@/components/ui/use-toast";
import { Link, useRouter } from "@/i18n/routing"; import { Link, useRouter } from "@/i18n/routing";
import { postActivityLog } from "@/service/content/content";
const DetailDocument = () => { const DetailDocument = () => {
const [selectedSize, setSelectedSize] = useState<string>("L"); const [selectedSize, setSelectedSize] = useState<string>("L");
@ -35,6 +36,7 @@ const DetailDocument = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -127,8 +129,7 @@ const DetailDocument = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); await postActivityLog(data);
// console.log(response);
} }
const handleDownload = () => { const handleDownload = () => {

View File

@ -10,6 +10,7 @@ import { getCookiesDecrypt } from "@/lib/utils";
import { close, error, loading } from "@/config/swal"; import { close, error, loading } from "@/config/swal";
import { checkWishlistStatus, deleteWishlist, getDetail, saveWishlist } from "@/service/landing/landing"; import { checkWishlistStatus, deleteWishlist, getDetail, saveWishlist } from "@/service/landing/landing";
import { Link, useRouter } from "@/i18n/routing"; import { Link, useRouter } from "@/i18n/routing";
import { postActivityLog } from "@/service/content/content";
const DetailInfo = () => { const DetailInfo = () => {
const [selectedSize, setSelectedSize] = useState<string>("L"); const [selectedSize, setSelectedSize] = useState<string>("L");
@ -35,6 +36,7 @@ const DetailInfo = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -127,7 +129,7 @@ const DetailInfo = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); await postActivityLog(data);
// console.log(response); // console.log(response);
} }

View File

@ -11,6 +11,7 @@ import { Textarea } from "@/components/ui/textarea";
import { getCookiesDecrypt } from "@/lib/utils"; import { getCookiesDecrypt } from "@/lib/utils";
import { close, error, loading } from "@/config/swal"; import { close, error, loading } from "@/config/swal";
import { useToast } from "@/components/ui/use-toast"; import { useToast } from "@/components/ui/use-toast";
import { postActivityLog } from "@/service/content/content";
const DetailVideo = () => { const DetailVideo = () => {
const [selectedSize, setSelectedSize] = useState<string>("L"); const [selectedSize, setSelectedSize] = useState<string>("L");
@ -34,6 +35,7 @@ const DetailVideo = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -126,8 +128,7 @@ const DetailVideo = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); postActivityLog(data);
// console.log(response);
} }
const handleDownload = () => { const handleDownload = () => {

View File

@ -21,6 +21,7 @@ import { checkMaliciousText, formatDateToIndonesian, getPublicLocaleTimestamp }
import parse from "html-react-parser"; import parse from "html-react-parser";
import $ from "jquery"; import $ from "jquery";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { postActivityLog } from "@/service/content/content";
const formWaveSurferOptions = (ref: any) => ({ const formWaveSurferOptions = (ref: any) => ({
container: ref, container: ref,
@ -74,6 +75,7 @@ const DetailAudio = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -163,8 +165,7 @@ const DetailAudio = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); await postActivityLog(data);
// console.log(response);
} }
const handleDownload = () => { const handleDownload = () => {

View File

@ -19,6 +19,7 @@ import withReactContent from "sweetalert2-react-content";
import Swal from "sweetalert2"; import Swal from "sweetalert2";
import parse from "html-react-parser"; import parse from "html-react-parser";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { postActivityLog } from "@/service/content/content";
const DetailDocument = () => { const DetailDocument = () => {
const [selectedSize, setSelectedSize] = useState<string>("L"); const [selectedSize, setSelectedSize] = useState<string>("L");
@ -58,6 +59,7 @@ const DetailDocument = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -161,8 +163,7 @@ const DetailDocument = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); await postActivityLog(data);
// console.log(response);
} }
const handleDownload = () => { const handleDownload = () => {

View File

@ -37,6 +37,7 @@ import parse from "html-react-parser";
import { Skeleton } from "@/components/ui/skeleton"; import { Skeleton } from "@/components/ui/skeleton";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import Image from "next/image"; import Image from "next/image";
import { postActivityLog } from "@/service/content/content";
interface Size { interface Size {
label: string; label: string;
@ -96,6 +97,7 @@ const DetailInfo = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -214,8 +216,7 @@ const DetailInfo = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); await postActivityLog(data);
// console.log(response);
} }
const handleDownload = () => { const handleDownload = () => {

View File

@ -21,6 +21,7 @@ import Swal from "sweetalert2";
import parse from "html-react-parser"; import parse from "html-react-parser";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import Image from "next/image"; import Image from "next/image";
import { postActivityLog } from "@/service/content/content";
interface Size { interface Size {
label: string; label: string;
@ -62,6 +63,7 @@ const DetailVideo = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
checkWishlist(); checkWishlist();
sendActivityLog(2);
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
@ -158,8 +160,7 @@ const DetailVideo = () => {
url: window.location.href, url: window.location.href,
}; };
// set activity // set activity
// const response = await postActivityLog(data, token); await postActivityLog(data);
// console.log(response);
} }
const handleDownload = () => { const handleDownload = () => {

View File

@ -1,3 +1,4 @@
import { httpPost } from "../http-config/http-base-service";
import { import {
httpDeleteInterceptor, httpDeleteInterceptor,
httpGetInterceptor, httpGetInterceptor,
@ -225,3 +226,11 @@ export async function deleteSPIT(id: any) {
const url = `media/spit?id=${id}`; const url = `media/spit?id=${id}`;
return httpDeleteInterceptor(url); return httpDeleteInterceptor(url);
} }
export async function postActivityLog(data: any) {
const url = `activity`;
const headers = {
"content-type": "application/json",
};
return httpPost(url, headers, data);
}

View File

@ -7,6 +7,7 @@ import { getCsrfToken } from "../auth";
export async function httpPost(pathUrl: any, headers: any, data?: any) { export async function httpPost(pathUrl: any, headers: any, data?: any) {
const resCsrf = await getCsrfToken(); const resCsrf = await getCsrfToken();
const csrfToken = resCsrf?.data?.token; const csrfToken = resCsrf?.data?.token;
const authToken = Cookies.get("access_token");
const defaultHeaders = { const defaultHeaders = {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -16,6 +17,7 @@ export async function httpPost(pathUrl: any, headers: any, data?: any) {
...defaultHeaders, ...defaultHeaders,
...headers, ...headers,
...(csrfToken ? { "X-XSRF-TOKEN": csrfToken } : {}), ...(csrfToken ? { "X-XSRF-TOKEN": csrfToken } : {}),
...(authToken ? { "Authorization" : `Bearer ${authToken}`} : {}),
}; };
const response = await axiosBaseInstance const response = await axiosBaseInstance