diff --git a/src/Pages/ManageCMS/AboutUs/AboutUs.tsx b/src/Pages/ManageCMS/AboutUs/AboutUs.tsx
index cc44cd9..2275af0 100644
--- a/src/Pages/ManageCMS/AboutUs/AboutUs.tsx
+++ b/src/Pages/ManageCMS/AboutUs/AboutUs.tsx
@@ -1,31 +1,19 @@
-import { Box, HStack, Text } from "@chakra-ui/react";
+import { Box, HStack, Skeleton, Text } from "@chakra-ui/react";
import MainFrame from "../../../components/MainFrame"
-import { p } from "framer-motion/client";
import AboutUsAddModel from "../../ManageCMS/AboutUs/AboutUsAddModel";
import { useGetAboutUsQuery } from "../../../Redux/Service/manage.aboutus.service";
-interface AboutUsContent {
- id: number;
- content: string;
-}
-
-interface ApiResponse {
- data: AboutUsContent[];
-}
-
const AboutUs = () => {
- // const {
- // data: data
- // } = useGetAboutUsQuery()
- const { data: response } = useGetAboutUsQuery<{ data: ApiResponse }>();
+ const { data, isLoading } = useGetAboutUsQuery();
+
+ const content = data?.data?.[0]?.content
console.log('====================================');
- console.log(response);
+ // console.log(response);
console.log('====================================');
- const content = response?.data?.[0]?.content || "No content available";
return (
@@ -47,9 +35,35 @@ const AboutUs = () => {
-
+ {/* Show Skeleton until content is available */}
+ {isLoading || !content ? (
+
+
+
+
+
+
+
+
+
+
+
+ ) : (
+
+ {content}
+
+ )}
+ {/*
{content}
-
+ */}
{/*
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Numquam soluta doloremque quibusdam facilis quas, unde hic eaque doloribus sed perferendis atque, eos dolores eius consectetur iure sint adipisci itaque tempora fugit quidem culpa provident possimus. Ullam, vitae in voluptatum dignissimos, quos blanditiis sequi aut repellat error eaque veritatis unde quam temporibus adipisci consectetur neque vero exercitationem dolor cum numquam maiores alias, totam minima quas. Possimus, ratione harum. Alias laboriosam nesciunt esse fugit deserunt pariatur corporis tempora quia veniam laborum aliquid enim voluptatibus asperiores minima tempore repudiandae vero quo porro, doloribus explicabo sit beatae et hic natus. Non earum nisi reiciendis?
*/}
diff --git a/src/Pages/ManageCMS/AboutUs/AboutUsAddModel.tsx b/src/Pages/ManageCMS/AboutUs/AboutUsAddModel.tsx
index 75b9c73..301c0de 100644
--- a/src/Pages/ManageCMS/AboutUs/AboutUsAddModel.tsx
+++ b/src/Pages/ManageCMS/AboutUs/AboutUsAddModel.tsx
@@ -1,53 +1,189 @@
-import { FaRegEdit } from "react-icons/fa"
-import { DialogBody, DialogCloseTrigger, DialogContent, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger } from "../../../components/ui/dialog"
-import { Field, Stack, Text, Textarea } from "@chakra-ui/react"
-import { Button } from "../../../components/ui/button"
+// import { FaRegEdit } from "react-icons/fa"
+// import { DialogBody, DialogCloseTrigger, DialogContent, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger } from "../../../components/ui/dialog"
+// import { Field, Stack, Text, Textarea } from "@chakra-ui/react"
+// import { Button } from "../../../components/ui/button"
+// import { useUpdateAboutUsMutation } from "../../../Redux/Service/manage.aboutus.service"
+
+// function AboutUsAddModel() {
+
+// const [ updateAboutUs ] = useUpdateAboutUsMutation()
+
+
+// try {
+// const res = updateAboutUs({id:2, updatedData:''})
+// console.log(res);
+
+
+// } catch (error) {
+
+// }
+
+
+
+
+// return (
+
+//
+//
+// {/* */}
+//
+
+//
+
+//
+//
+// Edit
+//
+
+//
+//
+
+//
+// AboutUs
+//
+//
+//
+//
+//
+//
+//
+
+//
+//
+//
+
+// )
+// }
+
+// export default AboutUsAddModel
+
+
+import React, { useState } from "react";
+import { FaRegEdit } from "react-icons/fa";
+import {
+ DialogBody,
+ DialogCloseTrigger,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogRoot,
+ DialogTitle,
+ DialogTrigger,
+} from "../../../components/ui/dialog";
+import { Field, Stack, Text, Textarea } from "@chakra-ui/react";
+import { Button } from "../../../components/ui/button";
+import { useUpdateAboutUsMutation } from "../../../Redux/Service/manage.aboutus.service";
function AboutUsAddModel() {
- return (
+ const [content, setContent] = useState(""); // State for the textarea input
+ const [updateAboutUs, { isLoading }] = useUpdateAboutUsMutation(); // Mutation for updating About Us
+ // const toast = useToast(); // Toast for feedback
+ // Handle form submission
+ const handleSubmit = async (e: any) => {
+ e.preventDefault(); // Prevent default form submission
+
+ try {
+ // Call the updateAboutUs mutation
+ const res = await updateAboutUs({ id: 2, updatedData: content }).unwrap();
+ console.log(res);
+
+ // Show success toast
+ // toast({
+ // title: "Success",
+ // description: "About Us content updated successfully",
+ // status: "success",
+ // duration: 5000,
+ // isClosable: true,
+ // });
+
+ // Clear the input field after successful submission
+ setContent("");
+ } catch (error) {
+ // Show error toast
+ // toast({
+ // title: "Error",
+ // description: "Failed to update About Us content",
+ // status: "error",
+ // duration: 5000,
+ // isClosable: true,
+ // });
+ }
+ };
+
+ return (
- {/* */}
-
-
+
-
- Edit
+
+
+ Edit
+
-
-
+
- AboutUs
-
+
+ AboutUs
+
+
-
-
-
-
- )
+
+ );
}
-export default AboutUsAddModel
\ No newline at end of file
+export default AboutUsAddModel;
\ No newline at end of file
diff --git a/src/Redux/Service/manage.aboutus.service.ts b/src/Redux/Service/manage.aboutus.service.ts
index 6b82556..428eb61 100644
--- a/src/Redux/Service/manage.aboutus.service.ts
+++ b/src/Redux/Service/manage.aboutus.service.ts
@@ -9,7 +9,7 @@ export const aboutUs = createApi({
// 🔹 GET: Fetch all posts
- getAboutUs: builder.query({
+ getAboutUs: builder.query({
query: () => "/about-us",
}),
@@ -24,18 +24,18 @@ export const aboutUs = createApi({
// 🔹 POST: Create a new post
createPost: builder.mutation>({
- query: (newPost) => ({
+ query: (data) => ({
url: "/posts",
method: "POST",
- body: newPost,
+ body: data,
}),
}),
// 🔹 PUT: Update an existing post
- updatePost: builder.mutation }>({
+ updateAboutUs: builder.mutation({
query: ({ id, updatedData }) => ({
url: `/posts/${id}`,
- method: "PUT",
+ method: "POST",
body: updatedData,
}),
}),
@@ -52,9 +52,20 @@ export const aboutUs = createApi({
export const {
useGetAboutUsQuery,
+ useUpdateAboutUsMutation,
+
+
+
+
+
+
+
+
+
+
+
useGetPostByIdQuery,
- useCreatePostMutation,
- useUpdatePostMutation,
+ useCreatePostMutation,
useDeletePostMutation
} = aboutUs;
@@ -66,9 +77,27 @@ export type Post = {
};
+export type UpdateAboutUsRequest={
+ id: number; updatedData: string
+}
+
+
+export type UpdateAboutUsResponse={
+ id: number; updatedData: string
+}
+
+
export type AboutUs = {
id: number;
language_master_xid: number;
content: string;
is_active: boolean;
};
+
+// First define your interface
+interface AboutUsResponse {
+ data: {
+ content: string;
+ // other fields...
+ }[];
+}
\ No newline at end of file