inp update, yanma update

This commit is contained in:
Rama Priyanto 2025-02-12 15:20:38 +07:00
parent f2e3d7f731
commit d641681ee4
8 changed files with 57 additions and 38 deletions

View File

@ -6,21 +6,18 @@ import Cookies from "js-cookie";
import React, { useEffect, useState } from "react";
export default function AuthPage() {
// const isAuthenticated = Cookies.get("is_authenticated") || "false";
const isAuthenticated = Cookies.get("is_authenticated") || "false";
// console.log("isAuthenticated : ", isAuthenticated);
console.log("isAuthenticated : ", isAuthenticated);
// const [hasMounted, setHasMounted] = useState(false);
const [hasMounted, setHasMounted] = useState(false);
// useEffect(() => {
// setHasMounted(true);
// }, []);
useEffect(() => {
setHasMounted(true);
}, []);
// // Render
// if (!hasMounted) return null;
// Render
if (!hasMounted) return null;
return <Login />;
// isAuthenticated == "true" ?
// : <QudoLogin />;
return isAuthenticated == "true" ? <Login /> : <QudoLogin />;
}

View File

@ -23,6 +23,12 @@ export default function CategorySatker() {
const t = useTranslations("Landing");
const list = [
{
id: 6,
img: "/assets/satker2/yanma.png",
title: "Yanma",
path: "/news/yanma",
},
{
id: 1,
img: "/assets/satker2/siber.svg",
@ -53,15 +59,21 @@ export default function CategorySatker() {
title: "Itwasum",
path: "/news/itwasum",
},
{
id: 6,
img: "/assets/satker2/stik-ptik.svg",
title: "STIK-PTIK",
path: "/news/stik-ptik",
},
// {
// id: 6,
// img: "/assets/satker2/stik-ptik.svg",
// title: "STIK-PTIK",
// path: "/news/stik-ptik",
// },
];
const SatkerAll = [
{
id: 36,
img: "/assets/satker2/yanma.png",
title: "Yanma",
path: "/news/yanma",
},
{
id: 1,
img: "/assets/satker2/siber.svg",
@ -328,7 +340,13 @@ export default function CategorySatker() {
key={index}
className="w-[157px] h-[140px] flex flex-col items-center justify-evenly "
>
<Image radius="lg" src={item.img} />
<Image
radius="lg"
src={item.img}
className="w-10 h-10"
height={480}
width={480}
/>
<p className="text-xs font-bold text-white">{item.title}</p>
</div>
</Link>
@ -378,8 +396,10 @@ export default function CategorySatker() {
>
{" "}
<Image
height={480}
width={480}
radius="lg"
className="h-[59px] "
className="h-[59px] w-[50px]"
src={item.img}
/>
</Link>

View File

@ -67,8 +67,8 @@ export default function HeaderNews() {
);
}}
>
{article?.map((newsItem: any) => (
<SwiperSlide key={newsItem.id}>
{article?.map((newsItem: any, index: number) => (
<SwiperSlide key={newsItem.id + index}>
<Card isFooterBlurred radius="lg" className="border-none">
<Image
width={1920}
@ -113,10 +113,10 @@ export default function HeaderNews() {
{t("berita")}
</p>
<ScrollShadow hideScrollBar className="h-[34vh] lg:h-[53vh] ">
{article?.map((data: any) => (
{article?.map((data: any, index: number) => (
<div
className="text-xs text-left m-2 p-2 dark:bg-[#1E1616] bg-white rounded-md flex flex-row gap-2"
key={data.id}
key={data.id + index}
>
<Image
height={480}
@ -197,8 +197,8 @@ export default function HeaderNews() {
);
}}
>
{article?.map((newsItem: any) => (
<SwiperSlide key={newsItem.id} className="h-[67vh]">
{article?.map((newsItem: any, index: number) => (
<SwiperSlide key={newsItem.id + index} className="h-[67vh]">
<Card
isFooterBlurred
radius="lg"
@ -271,9 +271,9 @@ export default function HeaderNews() {
{selectedTab === "media" ? (
<div className="lg:!h-[62vh] p-2 dark:bg-stone-800 bg-[#f0f0f0] dark:text-white text-black rounded-lg">
<ScrollShadow hideScrollBar className=" h-[54vh]">
{article?.map((list: any) => (
{article?.map((list: any, index: number) => (
<div
key={list.id}
key={list.id + index}
className="text-xs text-left m-2 p-2 dark:bg-[#1E1616] bg-white rounded-md"
>
<Link href={`news/detail/${list?.id}`}>

View File

@ -33,13 +33,13 @@ export default function MedolUpdate() {
const t = useTranslations("Landing");
useEffect(() => {
if (selectedTab === "mediahub" && mediahubUpdate.length < 1) {
if (selectedTab === "mediahub" && mediahubUpdate?.length < 1) {
getMedihubUpdate();
}
if (selectedTab === "tbnews" && tbnUpdate.length < 1) {
if (selectedTab === "tbnews" && tbnUpdate?.length < 1) {
getTbnUpdate();
}
if (selectedTab === "inp" && inpUpdate.length < 1) {
if (selectedTab === "inp" && inpUpdate?.length < 1) {
getInpUpdate();
}
}, [selectedTab]);

View File

@ -68,11 +68,11 @@ export default function NavbarHumas(props: { size: string }) {
const language = storedLanguage((state) => state.locale);
const setLanguage = storedLanguage((state) => state.setLocale);
// useEffect(() => {
// if (!isAuthenticated) {
// onLogout();
// }
// }, [token]);
useEffect(() => {
if (!isAuthenticated) {
onLogout();
}
}, [token]);
const onLogout = () => {
Object.keys(Cookies.get()).forEach((cookieName) => {

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 KiB

View File

@ -7,7 +7,8 @@ const tbnInstance = axios.create({
},
});
const inpInstance = axios.create({
baseURL: "https://inp.demoaplikasi.web.id/api",
baseURL: "https://inp.polri.go.id/api",
// baseURL: "https://inp.indoplusmedia.id/wp-json/wp/v2/posts",
headers: {
"content-type": "application/json",
},
@ -39,7 +40,7 @@ async function inpGetNews(pathUrl: any, headers: any) {
const response = await inpInstance
.get(pathUrl, { headers })
.catch(function (error: any) {
console.log(error);
console.log(error, "inp");
return error.response;
});
console.log("Response base svc : ", response);
@ -71,6 +72,7 @@ export async function topNewsInp() {
const headers = {
"content-type": "application/json",
};
// return await inpGetNews(`/media`, headers);
return await inpGetNews(`/artikel/data?per_page=10&page=1`, headers);
}