News added + Bugs fixed

Kahdooei
Hossein Rahmani 2024-01-25 20:39:25 +03:30
parent 1e0ca5c229
commit 5b06bfb943
12 changed files with 307 additions and 239 deletions

View File

@ -0,0 +1,7 @@
import NewsDetail from "@/components/NewsDetail";
import React from "react";
export default function page({ params }: { params: any }) {
const id = params.newsId;
return <NewsDetail id={id} />;
}

View File

@ -5,7 +5,7 @@ import Counter from "../../components/Counter";
import SubmitRequest from "../../components/SubmitRequest";
import { boxItems, newsItems } from "@/constants";
import Image from "next/image";
import { cn } from "@/lib/utils";
import { cn, convertDate } from "@/lib/utils";
import Link from "next/link";
import bgimg from "../../public/img/bg-slide.jpg";
import Footer from "@/components/Footer";
@ -19,7 +19,27 @@ import "swiper/css/pagination";
import { Autoplay, Pagination, Navigation } from "swiper/modules";
import { sliderItems } from "@/constants";
import { useQuery } from "@tanstack/react-query";
import { getSliders , getNews} from "@/utils/commonApi";
import { getSliders, getNews } from "@/utils/commonApi";
interface News {
id: string;
image: {
id: string;
url: string;
url2: string;
url3: string;
url4: string;
alternateText: string;
title: string;
mediaType: 0;
};
title: string;
description: string;
dateTime: string;
url: string;
content: string;
isDeleted: boolean;
}
export default function Landing() {
const { data, isLoading, refetch } = useQuery({
@ -29,12 +49,18 @@ export default function Landing() {
});
console.log(data);
const { data:NewsData, isLoading:NewsisLoading, isError:NewsisError, refetch:Newsrefetch } = useQuery({
const {
data: NewsData,
isLoading: NewsIsLoading,
isError: NewsIsError,
refetch: NewsRefetch,
} = useQuery({
queryKey: ["News"],
queryFn: () => getNews(),
refetchOnWindowFocus: false,
});
console.log("NewsData"+ NewsData);
return (
<div className="overflow-x-hidden max-md:-mt-8">
@ -127,7 +153,7 @@ export default function Landing() {
}
}}
>
<p className="text-xs text-center font-medium text-gray hidden group-hover:flex ">
<p className="text-xs text-center font-medium text-gray hidden group-hover:flex group-hover:text-white">
{item.description}
</p>
<p className=" z-10 text-base text-black group-hover:text-white max-md:text-sm">
@ -165,75 +191,79 @@ export default function Landing() {
<div className=" border mt-6 mx-auto py-3 px-4 rounded-lg">
آخرین اخبار
</div>
<div
className=" w-full mt-6 flex flex-row gap-8 mb-14 max-lg:flex-col max-lg:gap-4 ">
<div className=" w-full mt-6 flex flex-row gap-8 mb-14 max-lg:flex-col max-lg:gap-4 ">
{/* Right News */}
<div
className=" w-1/2 max-lg:w-full border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
{NewsData && (
<>
{" "}
<div
className=" w-1/2 max-lg:w-full border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
max-lg:h-[14em] max-md:h-[12em] max-sm:h-[22em] max-sm:flex-col max-sm:gap-[3px]"
>
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
<Image
alt="picture"
src="/img/pic1.png"
height={500}
width={500}
quality={100}
className="w-full h-full rounded-r-lg bg-cover object-cover object-center"
/>
</div>
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
<p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
اخبار
</p>
<p className="text-xs font-medium text-right text-black">
24 آذر ماه 1402
</p>
<p className="text-base font-medium text-right text-black line-clamp-1">
شروع به کار سامانه عیون
</p>
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور
مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده
است ...
</p>
<Link
href="#"
className="text-[10px] font-normal text-blue text-left"
>
بیشتر بخوانید{" "}
</Link>
</div>
</div>
{/* Left News */}
<div className=" w-1/2 max-lg:w-full flex flex-col gap-[2px] max-lg:gap-4">
{newsItems.map((item, index) => {
return (
<div
className=" w-full h-1/3 flex flex-col border rounded-lg justify-between px-8 py-[10px] hover:shadow-[0px_0px_8px_0px_#00000040] transition-all
max-lg:px-4 max-lg:gap-3"
key={index}
>
<div className="flex flex-row justify-between items-center max-sm:flex-col-reverse">
<p className="text-base font-medium text-right text-black max-sm:self-start">
{item.title}
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
<Image
alt="picture"
src={`${process.env.NEXT_PUBLIC_BASE_URL_APP}${NewsData[0]?.image?.url}`}
height={500}
width={500}
quality={100}
className="w-full h-full rounded-r-lg bg-cover object-cover object-center"
/>
</div>
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
<div className=" flex flex-col gap-2">
<p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
اخبار
</p>
<p className="text-xs font-medium text-right text-black max-sm:self-end">
{item.date}
<p className="text-xs font-medium text-right text-black">
{convertDate(NewsData[0]?.dataTime)}
</p>
<p className="text-base font-medium text-right text-black line-clamp-1">
{NewsData[0]?.title}
</p>
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
{NewsData[0]?.description ? NewsData[0]?.description : ""}
</p>
</div>
<p className="text-sm font-normal text-justify text-[#3C3C43D9] max-md:line-clamp-2">
{item.content}
</p>
<Link
href="#"
className="text-[10px] font-normal text-blue text-left"
>
بیشتر بخوانید{" "}
</Link>
</div>
);
})}
</div>
</div>
{/* Left News */}
<div className=" w-1/2 max-lg:w-full flex flex-col gap-[2px] max-lg:gap-4">
{NewsData.slice(1, 4).map((item: News, index: number) => {
return (
<div
className=" w-full h-1/3 flex flex-col border rounded-lg justify-between px-8 py-[10px] hover:shadow-[0px_0px_8px_0px_#00000040] transition-all
max-lg:px-4 max-lg:gap-3"
key={index}
>
<div className="flex flex-row justify-between items-center max-sm:flex-col-reverse">
<p className="text-base font-medium text-right text-black max-sm:self-start">
{item.title}
</p>
<p className="text-xs font-medium text-right text-black max-sm:self-end">
{convertDate(item.dateTime)}
</p>
</div>
<p className="text-sm font-normal text-justify text-[#3C3C43D9] max-md:line-clamp-3 md:line-clamp-2">
{item?.description}
</p>
</div>
);
})}
</div>
</>
)}
</div>
</div>
{/* Counter */}
<Counter />
{/* <Counter /> */}
{/*SubmitRequest */}
<SubmitRequest />
{/* Footer */}

View File

@ -101,4 +101,6 @@
border: 2px solid black;
}
.footer span{
color: white !important;
}

View File

@ -18,12 +18,6 @@ export default function AboutUs() {
refetch();
}, [title, refetch]);
if (isLoading) {
return <p>Loading...</p>;
}
if (isError) {
return <p>Error fetching content.</p>;
}
const fetchedContent = data?.content || ""; // Assuming your API response has a 'content' property

View File

@ -26,6 +26,7 @@ import { useReactToPrint } from "react-to-print";
import "../app/print-styles.css";
import ComplainsDetails from "./ComplainsDetails";
import { toast } from "sonner";
import { ArrowRight } from "lucide-react";
export default function FollowResult() {
const router = useRouter();
@ -88,9 +89,18 @@ export default function FollowResult() {
console.log(complaintPrintMutation?.data);
return (
<>
<div className="w-[90vw] sm:w-[90vw] lg:w-[85vw] xl:w-[75vw] 3xl:w-[70vw] max-sm:mt-16 pt-12 mx-auto mb-10">
<div className="w-[90vw] sm:w-[90vw] lg:w-[85vw] xl:w-[75vw] 3xl:w-[70vw] pt-6 mx-auto mb-10">
{complaintPrintMutation?.data ? (
<>
<button
onClick={() => router.push("/FollowUp")}
className="flex gap-1 cursor-pointer text-blue"
>
<span>
<ArrowRight />
</span>
<p>بازگشت</p>
</button>
{/* <div className="flex justify-center gap-2 mb-2 sm:justify-end">
<AlertDialog>
<AlertDialogTrigger asChild>

View File

@ -5,32 +5,37 @@ import img2 from "../public/img/footerImg2.png";
import { footerItems } from "@/constants";
import { aboutFooterItems } from "@/constants";
import Link from "next/link";
import { getSingleWebContents } from "@/utils/commonApi";
import { useQuery } from "@tanstack/react-query";
export default function Footer() {
const { data, isLoading, isError } = useQuery({
queryKey: ["WebContents", "AboutUs"],
queryFn: () => getSingleWebContents("AboutUs"),
refetchOnWindowFocus: false,
});
const fetchedContent = data?.content || "";
console.log(data);
return (
// <div classNameName="flex justify-center items-center w-full bg-blue ">
<footer className="bg-blue dark:bg-gray-900">
<div className="mx-auto w-full max-w-screen-3xl px-4 py-7 md:px-8 md:py-8 lg:pt-14 lg:pb-7 lg:px-11 ">
<div className="md:flex md:justify-between w-full ">
<div className="grid gap-10 sm:gap-16 md:gap-20 lg:gap-28 grid-cols-1 w-full md:grid-cols-2 md:w-3/4 lg:w-2/4">
<div className="grid gap-10 sm:gap-16 md:gap-20 lg:gap-28 grid-cols-1 w-full">
<div>
<h2 className="text-white text-sm sm:text-base font-bold mb-4 ">
درباره سامانه عیون
</h2>
{aboutFooterItems.map((item) => {
return (
<div key={item.id}>
<p className=" text-white text-xs md:text-sm font-normal md:leading-7">
{item.name}
</p>
</div>
);
})}
<div>
<p className=" text-white text-xs md:text-sm font-normal md:leading-7">
<div className=" !text-white footer" dangerouslySetInnerHTML={{ __html: fetchedContent }} />
</p>
</div>
</div>
<div>
{/* <div>
<h2 className="text-white text-sm sm:text-base font-bold mb-4">
دسترسی سریع
</h2>
@ -45,7 +50,7 @@ export default function Footer() {
);
})}
</ul>
</div>
</div> */}
</div>
{/* <div className=" max-md:mt-6 flex flex-row justify-center md:justify-end items-start w-full md:w-1/4 ">
@ -70,7 +75,6 @@ export default function Footer() {
/>
</div>
</div> */}
</div>
<hr className=" border-gray-200 sm:mx-auto dark:border-gray-700 mt-5 sm:mt-10" />

View File

@ -99,11 +99,7 @@ export default function InspectorOperations({
formData.append("text", data.text);
formData.append("trackingNumber", complaintData.trackingNumber);
formData.append("Operation", data.operation);
if (role == "Inspector") {
formData.append("EncodedKey", password);
} else {
formData.append("password", localStorage.getItem("password2") as string);
}
formData.append("password", localStorage.getItem("password2") as string);
if (data?.media && data?.media?.length > 0) {
for (let i = 0; i < data.media.length; i++) {
formData.append("Medias", data.media[i]);

View File

@ -5,146 +5,83 @@ import { getNews } from "@/utils/commonApi";
import { useQuery } from "@tanstack/react-query";
import Image from "next/image";
import Link from "next/link";
import { convertFullTime } from "@/lib/utils";
interface News {
id: string;
image: {
id: string;
url: string;
url2: string;
url3: string;
url4: string;
alternateText: string;
title: string;
mediaType: 0;
};
title: string;
description: string;
dateTime: string;
url: string;
content: string;
isDeleted: boolean;
}
export default function News() {
const { data, isLoading, isError, refetch } = useQuery({
queryKey: ["News"],
queryFn: () => getNews(),
refetchOnWindowFocus: false,
});
console.log(data);
if (isLoading) {
return <p>Loading...</p>;
}
if (isError) {
return <p>Error fetching content.</p>;
}
return (
<div className="bg-white dark:bg-gray-900 w-screen pt-8">
<div className="container w-full flex flex-wrap lg:flex-row gap-8 mb-14 flex-col max-lg:gap-4">
<div className="bg-white dark:bg-gray-900 pt-8 container">
<h2 className=" w-full font-bold mb-2">اخبار</h2>
<div className="w-full flex flex-wrap lg:flex-row gap-8 mb-14 flex-col max-lg:gap-4">
{/* {data.map((item: any, index: number) => {
return <p key={index}>News</p>;
})} */}
<div
className="w-full lg:w-[48%] border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
{data?.map((item: News) => {
return (
<div
className="w-full lg:w-[48%] border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
h-[20em] sm:h-[15em] max-sm:flex-col max-sm:gap-[3px]"
>
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
<Image
alt="picture"
src="/img/pic1.png"
height={500}
width={500}
quality={100}
className="w-full h-full rounded-r-lg bg-cover object-cover object-center"
/>
</div>
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
<p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
اخبار
</p>
<p className="text-xs font-medium text-right text-black">
24 آذر ماه 1402
</p>
<p className="text-base font-medium text-right text-black line-clamp-1">
شروع به کار سامانه عیون
</p>
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور
مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است
...
</p>
<Link
href="#"
className="text-[10px] font-normal text-blue text-left"
>
بیشتر بخوانید{" "}
</Link>
</div>
</div>
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
<Image
alt="picture"
src={`${process.env.NEXT_PUBLIC_BASE_URL_APP}${item?.image?.url}`}
height={500}
width={500}
quality={100}
className="w-full h-full rounded-r-lg bg-cover object-cover object-center"
/>
</div>
<div
className="w-full lg:w-[48%] border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
h-[20em] sm:h-[15em] max-sm:flex-col max-sm:gap-[3px]"
>
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
<Image
alt="picture"
src="/img/pic1.png"
height={500}
width={500}
quality={100}
className="w-full h-full rounded-r-lg bg-cover object-cover object-center"
/>
</div>
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
<p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
اخبار
</p>
<p className="text-xs font-medium text-right text-black">
24 آذر ماه 1402
</p>
<p className="text-base font-medium text-right text-black line-clamp-1">
شروع به کار سامانه عیون
</p>
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور
مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است
...
</p>
<Link
href="#"
className="text-[10px] font-normal text-blue text-left"
>
بیشتر بخوانید{" "}
</Link>
</div>
</div>
<div
className=" w-full lg:w-[48%] border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
h-[20em] sm:h-[15em] max-sm:flex-col max-sm:gap-[3px]"
>
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
<Image
alt="picture"
src="/img/pic1.png"
height={500}
width={500}
quality={100}
className="w-full h-full rounded-r-lg bg-cover object-cover object-center"
/>
</div>
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
<p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
اخبار
</p>
<p className="text-xs font-medium text-right text-black">
24 آذر ماه 1402
</p>
<p className="text-base font-medium text-right text-black line-clamp-1">
شروع به کار سامانه عیون
</p>
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور
مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است
...
</p>
<Link
href="#"
className="text-[10px] font-normal text-blue text-left"
>
بیشتر بخوانید{" "}
</Link>
</div>
</div>
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
{/* <p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
اخبار
</p> */}
<div className=" flex flex-col gap-1">
<p className="text-xs font-medium text-right text-black">
{convertFullTime(item.dateTime)}
</p>
<p className="text-base font-medium text-right text-black line-clamp-1">
{item.title}
</p>
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
{item?.description}
</p>
</div>
<Link
href={`News/${item.id}`}
className="text-[11px] font-normal text-blue text-left hover:underline"
>
بیشتر بخوانید{" "}
</Link>
</div>
</div>
);
})}
</div>
</div>
);

71
components/NewsDetail.tsx Normal file
View File

@ -0,0 +1,71 @@
"use client";
import { convertFullTime } from "@/lib/utils";
import { getNewsById } from "@/utils/commonApi";
import { useQuery } from "@tanstack/react-query";
import { ArrowRight } from "lucide-react";
import Image from "next/image";
import { useRouter } from "next/navigation";
import React from "react";
interface News {
id: string;
image: {
id: string;
url: string;
url2: string;
url3: string;
url4: string;
alternateText: string;
title: string;
mediaType: 0;
};
title: string;
description: string;
dateTime: string;
url: string;
content: string;
isDeleted: boolean;
}
export default function NewsDetail({ id }: { id: any }) {
const router = useRouter();
const { data, isLoading, isError, refetch } = useQuery({
queryKey: ["News", id],
queryFn: () => getNewsById(id),
});
return (
<div className="mt-10 w-full md:w-1/2 max-md:px-3">
{data && (
<>
<div className=" text-blue gap-1 mb-2 bg-gray-100 rounded-md p-2">
<div
className=" flex items-center cursor-pointer"
onClick={() => router.push("/News")}
>
<span>
<ArrowRight />
</span>
<span>بازگشت</span>
</div>
</div>
<p className=" font-bold mb-2">{data?.title}</p>
<div className=" w-full border ">
<Image
alt="picture"
src={`${process.env.NEXT_PUBLIC_BASE_URL_APP}${data?.image?.url}`}
height={500}
width={500}
quality={100}
className="w-full h-auto bg-cover object-cover rounded-md"
/>
</div>
<div className=" text-gray-500 mt-2">
{convertFullTime(data.dateTime)}
</div>
<div className="">{data.content}</div>
</>
)}
</div>
);
}

View File

@ -22,6 +22,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
import { editProfile, getProfile } from "@/utils/authenticateApi";
import { useRouter } from "next/navigation";
import { toast } from "sonner";
import { Oval } from "react-loader-spinner";
const FormSchema = z.object({
firstName: z.string().min(1, {
@ -63,8 +64,10 @@ export default function Profile() {
mutationKey: ["editProfile"],
mutationFn: editProfile,
onSuccess: (res) => {
router.push("/RequestStep2");
localStorage.setItem("authorized", "true");
refetch();
toast("پروفایل شما با موفقیت ویرایش شد.", {
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
@ -86,15 +89,9 @@ export default function Profile() {
}, [profileData]);
console.log(form.getValues());
function onSubmit(data: z.infer<typeof FormSchema>) {
// toast({
// title: "You submitted the following values:",
// description: (
// <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
// <code className="text-white">{JSON.stringify(data, null, 2)}</code>
// </pre>
// ),
// });
console.log(data);
const strNationalId = String(data.nationalId);
const payload = { ...data, nationalId: strNationalId };
console.log(data);
@ -104,13 +101,14 @@ export default function Profile() {
return (
<div className="w-full h-full pt-12 sm:w-2/3 md:w-2/4 max-sm:p-8">
<div className="flex flex-col justify-center h-full space-y-4 md:space-y-4">
<h2 className=" w-full font-bold">پروفایل کاربری</h2>
{profileData && (
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="flex flex-col w-full mt-6 "
className="flex flex-col w-full mt-6 "
>
<div className="flex flex-row flex-wrap justify-between">
<div className="flex flex-row flex-wrap justify-between border p-4 rounded-md">
<FormField
control={form.control}
name="firstName"
@ -123,7 +121,6 @@ export default function Profile() {
<Input
placeholder="نام خود را وارد نمایید"
{...field}
readOnly={true}
/>
</FormControl>
<FormMessage />
@ -142,7 +139,6 @@ export default function Profile() {
<Input
placeholder="نام خانوادگی خود را وارد نمایید"
{...field}
readOnly={true}
/>
</FormControl>
<FormMessage />
@ -162,7 +158,6 @@ export default function Profile() {
type="text"
placeholder="کد ملی خود را وارد نمایید "
{...field}
readOnly={true}
/>
</FormControl>
<FormMessage />
@ -170,6 +165,30 @@ export default function Profile() {
)}
/>
</div>
<div className="flex justify-end w-full gap-2 mt-8">
<Button
disabled={editProfileMutation.isPending}
type="submit"
className="w-32 p-2 text-white transition bg-blue hover:bg-blue/90 rounded-xl"
>
{editProfileMutation.isPending ? (
<div className="flex items-center justify-center gap-2">
<Oval
visible={true}
height="20"
width="20"
color="#fff"
ariaLabel="oval-loading"
wrapperStyle={{}}
wrapperClass=""
/>
</div>
) : (
"ذخیره"
)}
{/* ورود */}
</Button>
</div>
</form>
</Form>
)}

View File

@ -24,7 +24,7 @@ export default function SubmitRequest() {
درخواست و پیگیری آن را مشاهده می کنید.
</p>
<Link
href="#"
href="/RequestStep2"
className="text-sm font-bold text-blue text-left underline underline-offset-4"
>
برای شروع ارسال درخواست کلیک کنید.

View File

@ -15,33 +15,31 @@ export async function getOrganizations() {
// Get Captcha
export async function getCaptcha() {
const data = await axios.get("api/Common/Captcha", { responseType: "blob" });
console.log(data);
return data;
}
export async function getSliders() {
const data = await axios.get("api/Common/Sliders");
console.log(data);
return data.data;
}
export async function getWebContents() {
const data = await axios.get("api/Common/Contents");
console.log(data);
return data.data;
}
export async function getSingleWebContents( title: string ) {
export async function getSingleWebContents(title: string) {
const data = await axios.get(`api/Common/Contents/${title}`);
console.log(data);
return data.data;
}
// News
export async function getNews() {
const data = await axios.get("api/Common/News");
console.log(data);
return data.data;
}
export async function getNewsById(id: number) {
const data = await axios.get(`api/Common/News/${id}`);
return data.data;
}