This commit is contained in:
2024-06-10 15:54:14 +05:30
parent 9aebe87655
commit 4c1af2062c
21 changed files with 142 additions and 450 deletions

6
.env
View File

@@ -1,3 +1,3 @@
REACT_APP_BASE_URL="https://rubix.betadelivery.com/api"
REACT_APP_IMAGE_URL="https://rubix.betadelivery.com/"
REACT_APP_ENVIRONMENT="development"
VITE_API_BASE_URL="https://rubix.betadelivery.com/api"
VITE_API_IMAGE_URL="https://rubix.betadelivery.com"
VITE_API_ENVIRONMENT="development"

View File

@@ -37,6 +37,7 @@ import Header from "../../Components/Header";
import CommunityBannerCard from "../../Pages/Community/CommunityBannerCard";
import BannerMainCard from "./BannerMainCard";
import ToastBox from "../ToastBox";
import { IMAGE_URI } from "../../Constants/Paginations";
const BannerEdit = ({isLoading, data, updateBanner, navigateTo, refetch, center}) => {
const { id } = useParams();
@@ -78,7 +79,7 @@ const BannerEdit = ({isLoading, data, updateBanner, navigateTo, refetch, center}
useEffect(() => {
if (data?.data) {
setSelectedImage(
`https://rubix.betadelivery.com/${data?.data?.banner_image}`
`${IMAGE_URI}/${data?.data?.banner_image}`
);
setValue("heading", data?.data?.Heading);
setValue("sub_heading", data?.data?.sub_heading);

View File

@@ -4,7 +4,7 @@ import React from 'react'
const BannerMainCard = ({heading, subHeading, buttonTitle, imgLink, center}) => {
const words = heading.split(' ');
const words = heading?.split(' ');
const firstThreeWords = words.slice(0, 3).join(' ');
const remainingWords = words.slice(3).join(' ');

View File

@@ -22,7 +22,7 @@ import CustomAlertDialog from "../../Components/CustomAlertDialog";
import DataTable from "../DataTable/DataTable";
import Header from "../Header";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
import { TABLE_PAGINATION } from "../../Constants/Paginations";
import { IMAGE_URI, TABLE_PAGINATION } from "../../Constants/Paginations";
import {
CheckCircleIcon,
ChevronLeftIcon,
@@ -159,7 +159,7 @@ const BannerCommunity = ({
h={14}
rounded={4}
objectFit="cover"
src={`https://rubix.betadelivery.com/${item.banner_image}`}
src={`${IMAGE_URI}/${item.banner_image}`}
alt="Dan Abramov"
/>
),

View File

@@ -24,6 +24,7 @@ const TabularView = ({
setPageSize,
totalPages,
noDataTitle,
totalItems,
}) => {
const [displayRange, setDisplayRange] = useState({
start: TABLE_PAGINATION?.page,
@@ -38,15 +39,14 @@ const TabularView = ({
};
const paginationNext = () => {
const totalPage = Math.ceil(totalPages / pageSize);
if (currentPage < totalPage) {
if (currentPage < totalPages) {
setCurrentPage(currentPage + 1);
updateDisplayRange(currentPage + 1);
}
};
const updateDisplayRange = (page) => {
const start = (page - 1) * pageSize + 1;
const end = Math.min(start + pageSize - 1, totalPages);
const end = Math.min(start + pageSize - 1, totalItems);
setDisplayRange({ start, end });
};
@@ -100,7 +100,9 @@ const TabularView = ({
value={pageSize}
onChange={(e) => setPageSize(e.target.value)}
>
<option value={pageSize}>{pageSize}</option>
<option value={5}>{5}</option>
<option value={10}>{10}</option>
<option value={15}>{15}</option>
</Select>
<HStack>
@@ -109,7 +111,7 @@ const TabularView = ({
className=" link rounded-3 pointer"
/>
<Text className="web-text-medium" as={"span"}>
{displayRange.start} - {displayRange.end} of {totalPages}
{displayRange.start} - {displayRange.end} of {totalItems}
</Text>
<ChevronRightIcon
onClick={paginationNext}

View File

@@ -1 +1,2 @@
export const TABLE_PAGINATION = { page: 1, size: 15 }
export const TABLE_PAGINATION = { page: 1, size: 10 }
export const IMAGE_URI = import.meta.env.VITE_API_IMAGE_URL

View File

@@ -66,7 +66,7 @@ const BlogsAndArticles = () => {
const [deleteIsLoading, setDeleteIsLoading] = useState(false);
const [searchTerm, setSearchTerm] = useState("");
const [statusFilter, setStatusFilter] = useState("all");
const blog = useGetBlogQuery();
const blog = useGetBlogQuery({ page: currentPage, size: pageSize });
const [deleteBlog] = useDeleteBlogMutation();
const [updateBlogStatus] = useUpdateBlogStatusMutation();
// ====================================================[Functions]===================================================================
@@ -280,7 +280,8 @@ const BlogsAndArticles = () => {
setPageSize={setPageSize}
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={blog?.data?.data?.totalItems}
totalItems={blog?.data?.data?.totalItems}
totalPages={blog?.data?.data?.totalPages}
noDataTitle={'blog'}
/>
<CustomAlertDialog

View File

@@ -33,7 +33,13 @@ import {
VStack,
} from "@chakra-ui/react";
import { GrAdd } from "react-icons/gr";
import { AddIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, HamburgerIcon } from "@chakra-ui/icons";
import {
AddIcon,
ChevronDownIcon,
ChevronLeftIcon,
ChevronRightIcon,
HamburgerIcon,
} from "@chakra-ui/icons";
import DataTable from "../../Components/DataTable/DataTable";
import CommunityBanner from "../../Components/CommunityBanner";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
@@ -56,6 +62,7 @@ import CommunityBannerCard from "./CommunityBannerCard";
import Header from "../../Components/Header";
import { TABLE_PAGINATION } from "../../Constants/Paginations";
import ToastBox from "../../Components/ToastBox";
import TabularView from "../../Components/TabularView/TabularView";
const Community = () => {
// ====================================================[Hooks]===================================================================
@@ -68,20 +75,16 @@ const Community = () => {
const [searchTerm, setSearchTerm] = useState("");
const [statusFilter, setStatusFilter] = useState("all");
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
const [currentPage, setCurrentPage] = useState(1);
const [displayRange, setDisplayRange] = useState({ start: TABLE_PAGINATION?.page, end: pageSize });
const [displayRange, setDisplayRange] = useState({
start: TABLE_PAGINATION?.page,
end: pageSize,
});
const community = useGetCommunityQuery({ page: currentPage, size: pageSize });
const [deleteCommunity] = useDeleteCommunityMutation();
const [updateCommunityStatus] = useUpdateCommunityStatusMutation();
@@ -119,7 +122,10 @@ const Community = () => {
if (response?.data?.statusCode === 201) {
toast({
render: () => (
<ToastBox status={"success"} message={response?.data?.message} />
<ToastBox
status={"success"}
message={response?.data?.message}
/>
),
});
}
@@ -187,9 +193,11 @@ const Community = () => {
</RouterLink>
),
Description: (
<Box w={350} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.description}
</Text>
</Box>
),
"Linked In": (
<Link href={item?.linkedin} isExternal>
@@ -254,8 +262,6 @@ const Community = () => {
};
});
// ====================================================[Pagination Setup]================================================================
const paginationPrev = () => {
if (currentPage > 1) {
@@ -273,232 +279,35 @@ const Community = () => {
};
const updateDisplayRange = (page) => {
const start = (page - 1) * pageSize + 1;
const end = Math.min(start + pageSize - 1, community?.data?.data?.totalItems);
const end = Math.min(
start + pageSize - 1,
community?.data?.data?.totalItems
);
setDisplayRange({ start, end });
};
return (
<Box
{...OPACITY_ON_LOAD}
overflowY={"scroll"}
paddingBottom={50}
height={"100vh"}
>
<Header
title={"Community"}
btnTitle={"Create member"}
link={"/community/add-comunity"}
/>
<Box pt={4}>
{/* <HStack
display={"flex"}
justifyContent={"space-between"}
alignItems={"center"}
pe={1}
> */}
{/* <Text
as={"span"}
color={"teal.800"}
className="web-text-large fw-bold"
>
Community banner
</Text>
<RouterLink to="/community/add-banner">
<Button
leftIcon={<AddIcon />}
backgroundColor={"purple.700"}
_hover={{
backgroundColor: "purple.800",
}}
color={"whitesmoke"}
size="sm"
>
Create banner
</Button>
</RouterLink>
</HStack> */}
{/* <Box
display={"flex"}
// bg={"red.500"}
alignItems={"start"}
flexWrap={"wrap"}
justifyContent={"start"}
gap={3}
w={"100%"}
h={"auto"}
spacing="24px"
p={3}
> */}
{/* {communityBanner?.isLoading ? <Skeleton
h={"100%"}
w={"100%"}
borderRadius={6}/> :
<Box
bgImage={`https://rubix.betadelivery.com/${banner?.banner_image}`}
bgSize="cover"
bgPosition="center"
cursor={'pointer'}
h={"100%"}
w={"100%"}
borderRadius={6}
display={"flex"}
p={10}
justifyContent={"center"}
alignItems={"start"}
flexDirection={"column"}
position={'relative'}
>
<Text
mt={10}
w={400}
color={"white"}
className="fw-bolder"
as={"h1"}
>
{banner?.Heading}
</Text>
<Text
w={600}
color={"white"}
as={"p"}
className="fw-bolder web-text-large"
>
{banner?.sub_heading}
</Text>
<WebButton title={banner?.CTO_button_title} />
<Text opacity={0.3} position={'absolute'} bottom={0} right={4} className="web-text-small text-white">Last update: {formatDate(banner?.createdAt)}</Text>
</Box>} */}
{/* {communityBanner?.isLoading
? Array.from({ length: 3 }).map((_, index) => (
<Skeleton rounded={"md"} w={352} height={150} />
))
: banner?.map(
({
id,
CTO_button_title,
banner_image,
Heading,
createdAt,
sub_heading,
}) => (
<CommunityBannerCard
key={id}
bgImage={banner_image}
subHeading={sub_heading}
heading={Heading}
createdAt={createdAt}
ctoBtnTitle={CTO_button_title}
/>
)
)}
</Box>*/}
</Box>
{/* ====================================================[ Top bar ]================================================================ */}
{/* <Divider /> */}
<Box
bg="white.500"
>
{/* <HStack>
<Text color={"teal.800"} className="web-text-large fw-bold">
Community cards
</Text>
</HStack> */}
<HStack
display={"flex"}
justifyContent={"space-between"}
ps={1}
pe={1}
pb={4}
spacing="24px"
>
<Input
type="search"
width={300}
placeholder="Search..."
size="sm"
rounded="sm"
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
/>
<HStack>
<Select
className="pointer web-text-small"
width={"90px"}
rounded="sm"
size="sm"
value={statusFilter}
onChange={(e) => setStatusFilter(e.target.value)}
>
<option value="all">All</option>
<option value="active">Active</option>
<option value="inactive">Inactive</option>
</Select>
<Select
className="pointer web-text-small"
width={"90px"}
rounded="sm"
size="sm"
value={pageSize}
onChange={(e) => setPageSize(e.target.value)}
>
<option value={pageSize}>{pageSize}</option>
{/* <option value={20}>20 rows</option>
<option value={30}>30 rows</option> */}
</Select>
<HStack>
<ChevronLeftIcon
onClick={paginationPrev}
className=" link rounded-3 pointer"
/>
<Text className="web-text-medium" as={"span"}>
{displayRange.start} - {displayRange.end} of{" "}
{community?.data?.data?.totalItems}
</Text>
<ChevronRightIcon
onClick={paginationNext}
className=" link rounded-3 pointer"
/>
</HStack>
</HStack>
</HStack>
</Box>
{/* ====================================================[ Table ]================================================================ */}
<DataTable
emptyMessage={"We don't have any blog for this author"}
<>
<TabularView
title={"Community"}
btnTitle={"Create member"}
link={"/community/add-community"}
apiData={community}
tableHeadRow={tableHeadRow}
data={extractedArray}
isLoading={community?.isLoading}
extractedArray={extractedArray}
searchTerm={searchTerm}
setSearchTerm={setSearchTerm}
statusFilter={statusFilter}
setStatusFilter={setStatusFilter}
pageSize={pageSize}
setPageSize={setPageSize}
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalItems={community?.data?.data?.totalItems}
totalPages={community?.data?.data?.totalPages}
noDataTitle={"community's"}
/>
{/* <Divider /> */}
{/* <HStack>
<Text color={"teal.800"} className="web-text-large fw-bold">
Community cards
</Text>
</HStack>
<RouterLink to="/community-table-view">
<CommunityCardDisplay />
</RouterLink> */}
{/* ====================================================[ Alert ]================================================================ */}
<CustomAlertDialog
onClose={() => setDeleteAlert(false)}
@@ -507,7 +316,7 @@ const Community = () => {
message={"Are you sure you want to delete community?"}
isLoading={deleteIsLoading}
/>
</Box>
</>
);
};

View File

@@ -28,6 +28,7 @@ import { Link as RouterLink } from "react-router-dom";
import { formatDate } from "../../Components/Functions/UTCConvertor";
import CustomAlertDialog from "../../Components/CustomAlertDialog";
import ToastBox from "../../Components/ToastBox";
import TabularView from "../../Components/TabularView/TabularView";
const Events = () => {
// ====================================================[Hooks]===================================================================
@@ -207,88 +208,27 @@ const Events = () => {
});
return (
<Box
{...OPACITY_ON_LOAD}
overflowY={"scroll"}
overflowX={"hidden"}
paddingBottom={50}
height={"100vh"}
>
<Header
<>
<TabularView
title={"Events"}
btnTitle={"Create event"}
link={"/events/add-events"}
/>
<Box pt={4}>
<HStack
display={"flex"}
justifyContent={"space-between"}
ps={1}
pe={1}
pb={4}
spacing="24px"
>
<Input
type="search"
width={300}
rounded="sm"
placeholder="Search..."
size="sm"
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
/>
<HStack>
<Select
className="pointer web-text-small"
width={"90px"}
rounded="sm"
size="sm"
value={statusFilter}
onChange={(e) => setStatusFilter(e.target.value)}
>
<option value="all">All</option>
<option value="active">Active</option>
<option value="inactive">Inactive</option>
</Select>
<Select
className="pointer web-text-small"
width={"90px"}
rounded="sm"
size="sm"
value={pageSize}
onChange={(e) => setPageSize(e.target.value)}
>
<option value={pageSize}>{pageSize} rows</option>
{/* <option value={20}>20 rows</option>
<option value={30}>30 rows</option> */}
</Select>
<HStack>
<ChevronLeftIcon
onClick={paginationPrev}
className=" link rounded-3 pointer"
/>
<Text className="web-text-medium" as={"span"}>
{displayRange.start} - {displayRange.end} of{" "}
{events?.data?.data?.totalItems}
</Text>
<ChevronRightIcon
onClick={paginationNext}
className=" link rounded-3 pointer"
/>
</HStack>
</HStack>
</HStack>
</Box>
{/* ====================================================[ Table ]================================================================ */}
<DataTable
emptyMessage={"We don't have any blog for this author"}
apiData={events}
tableHeadRow={tableHeadRow}
data={extractedArray}
isLoading={events?.isLoading}
extractedArray={extractedArray}
searchTerm={searchTerm}
setSearchTerm={setSearchTerm}
statusFilter={statusFilter}
setStatusFilter={setStatusFilter}
pageSize={pageSize}
setPageSize={setPageSize}
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalItems={events?.data?.data?.totalItems}
totalPages={events?.data?.data?.totalPages}
noDataTitle={"event's"}
/>
{/* ====================================================[ Alert ]================================================================ */}
@@ -299,7 +239,7 @@ const Events = () => {
message={"Are you sure you want to delete event?"}
isLoading={deleteIsLoading}
/>
</Box>
</>
);
};

View File

@@ -40,19 +40,15 @@ const Faq = () => {
const [actionStatus, setActionStatus] = useState(null);
const [deleteIsLoading, setDeleteIsLoading] = useState(false);
const faqPage = useCreateFaqMutation({
page: currentPage,
size: pageSize,
});
const faqPage = useCreateFaqMutation();
const faq = useGetFaqQuery({ page: currentPage, size: pageSize });
const { data } = useGetFaqQuery();
const faq = data?.data?.rows;
// console.log(faq);
const [deleteFaq] = useDeleteFaqMutation();
const [updateFaqStatus] = useUpdateFaqStatusMutation();
const filteredData = faq?.filter((item) => {
const filteredData = faq?.data?.data?.rows?.filter((item) => {
// Filter by name (case insensitive)
const name = item.question;
const searchLower = searchTerm.toLowerCase();
@@ -241,7 +237,8 @@ const Faq = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={faq?.data?.data?.totalPages}
noDataTitle={"faq"}
totalItems={faq?.data?.data?.totalItems}
noDataTitle={"FAQ's"}
/>
<CustomAlertDialog
onClose={() => setDeleteAlert(false)}

View File

@@ -62,11 +62,12 @@ const Login = () => {
// dispatch(loginUser(true));
setIsAuthenticate(false)
setIsLoading(false);
toast({
title: `Invalid Credentials`,
status: "error",
isClosable: true,
})
render: () => (
<ToastBox status={"error"} message={"Invalid credentials"} />
),
});
reset();
navigate("/login");
}, 2000);

View File

@@ -50,7 +50,7 @@ const NewsLetter = () => {
const [actionStatus, setActionStatus] = useState(null);
const [deleteIsLoading, setDeleteIsLoading] = useState(false);
const { data } = useGetNewsLetterQuery();
const { data } = useGetNewsLetterQuery({ page: currentPage, size: pageSize });
// // console.log(useGetNewsletterQuery);
const email = data?.data?.rows;
// console.log(email);
@@ -123,20 +123,20 @@ const NewsLetter = () => {
const extractedArray = email?.map((item, index) => {
return {
Title: (
<Tooltip
className="rounded-2 web-text-xsmall"
width={"fit-content"}
placement="top"
hasArrow
label={item?.email}
bg="blue.200"
>
<Box display={"flex"} alignItems={"center"} w={200}>
<Text as={"span"} isTruncated={true}>
{item?.email}
</Text>
</Box>
</Tooltip>
<Tooltip
className="rounded-2 web-text-xsmall"
width={"fit-content"}
placement="top"
hasArrow
label={item?.email}
bg="blue.200"
>
<Box display={"flex"} alignItems={"center"} w={200}>
<Text as={"span"} isTruncated={true}>
{item?.email}
</Text>
</Box>
</Tooltip>
),
"Created At": (
<Box
@@ -215,6 +215,7 @@ const NewsLetter = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={email?.data?.data?.totalPages}
totalItems={email?.data?.data?.totalItems}
noDataTitle={"NewsLetter"}
/>
<CustomAlertDialog

View File

@@ -130,8 +130,7 @@ const News = () => {
];
const extractedArray = filteredData?.map((item, index) => {
return {
Title:
<RouterLink to={`view/${item.id}`}>{item?.title}</RouterLink>,
Title: <RouterLink to={`view/${item.id}`}>{item?.title}</RouterLink>,
Description: (
<Tooltip
className="rounded-2 web-text-xsmall"
@@ -249,7 +248,8 @@ const News = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={news?.data?.data?.totalPages}
noDataTitle={'news'}
totalItems={news?.data?.data?.totalItems}
noDataTitle={"news"}
/>
<CustomAlertDialog
onClose={() => setDeleteAlert(false)}

View File

@@ -145,52 +145,6 @@ const Partner = () => {
};
});
// ====================================================[Functions]===================================================================
// const handleDelete = async (communityId, status) => {
// if (status) {
// return toast({
// render: () => (
// <ToastBox
// status={"warn"}
// message={"Can't delete Partner. Status is true."}
// />
// ),
// });
// }
// try {
// // Trigger the mutation
// setDeleteIsLoading(true);
// await deletePartners(communityId)
// .then((response) => {
// // Handle the response here
// // console.log("Mutation response:", response?.data?.statusCode);
// // console.log("Mutation response:", response?.data?.message);
// if (response?.data?.statusCode === 201) {
// setDeleteIsLoading(false);
// setDeleteAlert(false);
// toast({
// render: () => (
// <ToastBox
// status={"success"}
// message={response?.data?.message}
// />
// ),
// });
// }
// })
// .catch((error) => {
// // console.error("Error creating community:", error);
// setDeleteIsLoading(false);
// setDeleteAlert(false);
// });
// } catch (error) {
// // Handle errors
// // console.log("Error deleting community:", error);
// }
// };
const handleDelete = async (communityId, status) => {
if (status) {
return toast({
@@ -290,6 +244,7 @@ const Partner = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={partners?.data?.data?.totalPages}
totalItems={partners?.data?.data?.totalItems}
noDataTitle={"partners"}
/>
<CustomAlertDialog

View File

@@ -233,6 +233,7 @@ const Policy = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={policy?.data?.data?.totalPages}
totalItems={policy?.data?.data?.totalItems}
noDataTitle={"policy"}
/>
<CustomAlertDialog

View File

@@ -235,6 +235,7 @@ const Terms = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={terms?.data?.data?.totalPages}
totalItems={terms?.data?.data?.totalItems}
noDataTitle={"terms"}
/>
<CustomAlertDialog

View File

@@ -253,6 +253,7 @@ const Usecase = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={useCase?.data?.data?.totalPages}
totalItems={useCase?.data?.data?.totalItems}
noDataTitle={"usecase"}
/>
<CustomAlertDialog

View File

@@ -74,13 +74,13 @@ const Videos = () => {
const extractedArray = filteredData?.map((item, index) => {
return {
Title: (
<Link to={`/videos/view/${item.id}`}>
<Box display={"flex"} alignItems={"center"} w={250}>
<Text as={"span"} isTruncated={true}>
{item?.title}
</Text></Box>
Title: (
<Link to={`/videos/view/${item.id}`}>
<Box display={"flex"} alignItems={"center"} w={250}>
<Text as={"span"} isTruncated={true}>
{item?.title}
</Text>
</Box>
</Link>
),
Description: (
@@ -92,7 +92,7 @@ const Videos = () => {
label={item?.description}
bg="blue.200"
>
<Box display={"flex"} alignItems={"center"} w={500}>
<Box display={"flex"} alignItems={"center"} w={350}>
<Text as={"span"} isTruncated={true}>
{item?.description}
</Text>
@@ -182,10 +182,6 @@ const Videos = () => {
}
};
const handleUpdateStatus = async (id) => {
try {
// Trigger the mutation
@@ -211,13 +207,6 @@ const Videos = () => {
}
};
return (
<>
<TabularView
@@ -235,8 +224,9 @@ const Videos = () => {
setPageSize={setPageSize}
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalItems={videos?.data?.data?.data?.totalItems}
totalPages={videos?.data?.data?.data?.totalPages}
noDataTitle={'video'}
noDataTitle={"video"}
/>
<CustomAlertDialog
onClose={() => setDeleteAlert(false)}
@@ -251,6 +241,4 @@ const Videos = () => {
export default Videos;
// Event & Community Pending
// Event & Community Pending

View File

@@ -234,6 +234,7 @@ const Whitepapers = () => {
setPageSize={setPageSize}
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalItems={whitePaper?.data?.data?.data?.totalItems}
totalPages={whitePaper?.data?.data?.data?.totalPages}
noDataTitle={'whitepaper'}
/>

View File

@@ -96,7 +96,7 @@ export const RouteLink = [
{ path: "/community", Component: Community },
{ path: "community/view/:id", Component: ComunityViewPage },
{ path: "community/edit/:id", Component: ComunityEditPage },
{ path: "community/add-comunity", Component: AddComunity },
{ path: "community/add-community", Component: AddComunity },
// =============[ Community banner ]================
{ path: "banner/banner-community", Component: BannerCommunity },

View File

@@ -1,7 +1,9 @@
// Need to use the React-specific entry point to import createApi
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
const baseUrl = "https://rubix.betadelivery.com/api";
const baseUrl = import.meta.env.VITE_API_BASE_URL
// Define a service using a base URL and expected endpoints
export const rubixApi = createApi({
@@ -40,7 +42,7 @@ export const rubixApi = createApi({
"getFaq",
"getPartners",
'getNewsLetter',
"getNewsLetter",
],
endpoints: (builder) => ({
// ===============[ Community cards endpoints ]=======================
@@ -246,7 +248,7 @@ export const rubixApi = createApi({
// ================[ Blog endpoints ]====================
getBlog: builder.query({
query: () => "/admin/blog",
query: ({ page, size }) => `/admin/blog?page=${page}&size=${size}`,
providesTags: ["getBlog"],
}),
getBlogById: builder.query({
@@ -538,11 +540,9 @@ export const rubixApi = createApi({
invalidatesTags: ["getWhitePaper"],
}),
// ===============[ Usecase endpoints ]=======================
getUsecase: builder.query({
query: () => "/admin/tech",
query: ({ page, size }) => `/admin/tech?page=${page}&size=${size}`,
providesTags: ["getUseCase"],
}),
createUsecase: builder.mutation({
@@ -581,12 +581,10 @@ export const rubixApi = createApi({
invalidatesTags: ["getUseCase"],
}),
// ===============[ Terms endpoints ]=======================
getTerms: builder.query({
query: () => "/admin/term-condition",
query: ({ page, size }) =>
`/admin/term-condition?page=${page}&size=${size}`,
providesTags: ["getTerms"],
}),
deleteTerms: builder.mutation({
@@ -626,7 +624,7 @@ export const rubixApi = createApi({
// ===============[ Terms endpoints ]=======================
getPolicy: builder.query({
query: () => "/admin/policy",
query: ({ page, size }) => `/admin/policy?page=${page}&size=${size}`,
providesTags: ["getPolicy"],
}),
deletePolicy: builder.mutation({
@@ -666,7 +664,7 @@ export const rubixApi = createApi({
// ===============[ Faq endpoints ]=======================
getFaq: builder.query({
query: () => "/admin/faq",
query: ({ page, size }) => `/admin/faq?page=${page}&size=${size}`,
providesTags: ["getFaq"],
}),
deleteFaq: builder.mutation({
@@ -704,10 +702,9 @@ export const rubixApi = createApi({
providesTags: ["getFaq"],
}),
// ===============[ Cards endpoints ]=======================
getPartners: builder.query({
query: () => "/admin/card",
query: ({ page, size }) => `/admin/card?page=${page}&size=${size}`,
providesTags: ["getPartners"],
}),
deletePartners: builder.mutation({
@@ -747,8 +744,8 @@ export const rubixApi = createApi({
// ===============[ Cards endpoints ]=======================
getNewsLetter: builder.query({
query: () => 'newsLetter/request',
providesTags: ['getNewsLetter'],
query: ({ page, size }) => `newsLetter/request?page=${page}&size=${size}`,
providesTags: ["getNewsLetter"],
}),
deleteEmail: builder.mutation({
query: (id) => ({
@@ -758,14 +755,12 @@ export const rubixApi = createApi({
invalidatesTags: ["getNewsLetter"],
}),
getNewsLetterEmail: builder.query({
query: () => 'newsLetter/request',
providesTags: ['getNewsLetter'],
query: () => "newsLetter/request",
providesTags: ["getNewsLetter"],
}),
}),
});
export const {
useGetCommunityQuery,
useGetCommunityByIdQuery,
@@ -858,8 +853,6 @@ export const {
useGetUsecaseQuery,
useUpdateUsecaseStatusMutation,
useGetTermsQuery,
useDeleteTermsMutation,
useCreateTermsMutation,
@@ -891,5 +884,4 @@ export const {
useGetNewsLetterQuery,
useDeleteEmailMutation,
useGetNewsLetterEmailQuery,
} = rubixApi;