diff --git a/src/components/Blogs/index.jsx b/src/components/Blogs/index.jsx index 7d10246..0876ce8 100644 --- a/src/components/Blogs/index.jsx +++ b/src/components/Blogs/index.jsx @@ -1,38 +1,76 @@ -import React, { useState } from "react"; -import { Link } from "react-router-dom"; +import React, { useEffect, useState } from "react"; +import { Link, useNavigate } from "react-router-dom"; import Layout from "../Partials/Layout"; import CommonHead from "../UserHeader/CommonHead"; +import usersService from "../../services/UsersService"; +import LoadingSpinner from "../Spinners/LoadingSpinner"; export default function BlogItem(props) { + + const apiCall = new usersService() + const navigate = useNavigate() + + const [blogdata, setBlogdata] = useState({loading: true, data:{}}) + const [selectTab, setValue] = useState("today"); const filterHandler = (value) => { setValue(value); }; + const queryParams = new URLSearchParams(location?.search); + const blog_id = queryParams.get("blog_id"); + + useEffect(()=>{ + if(!blog_id){ + navigate('/',{replace:true}) + } + apiCall.getSingleBlogData({blog_id}).then(res => { + setBlogdata({loading: false, data:res.data}) + }).catch(error => { + setBlogdata({loading: false, data:{}}) + console.log('ERROR', error) + }) + },[blog_id]) return (
-
- {/* heading */} -
-
-

- - Title of this Blog Items - -

-
-
- -
+
+

+ + {blogdata.data?.blogdata?.[0]?.post_title} + +

+
+
+ {blogdata.loading ? + + : + blogdata?.data?.blogdata && blogdata.data?.blogdata.length ? +
+ {/* heading */} +
+ {/*
+

+ + {blogdata.data?.blogdata?.[0]?.post_title} + +

+
*/} + {/*
+
*/} +
+
+
-
- Blog Items Details need implenet -
+ : +

No Blog Found!

+ }
diff --git a/src/components/Cards/HomeBannerOffersCard.jsx b/src/components/Cards/HomeBannerOffersCard.jsx index 72f4a58..1532d2a 100644 --- a/src/components/Cards/HomeBannerOffersCard.jsx +++ b/src/components/Cards/HomeBannerOffersCard.jsx @@ -16,7 +16,8 @@ export default function HomeBannerOffersCard(props) { return (
{/* title */} - +

{datas.post_title || "dummy title..."}

-
+
diff --git a/src/components/Helpers/SearchCom.jsx b/src/components/Helpers/SearchCom.jsx index 107bbaf..62fb7f3 100644 --- a/src/components/Helpers/SearchCom.jsx +++ b/src/components/Helpers/SearchCom.jsx @@ -7,6 +7,7 @@ export default function SearchCom({ placeholder, handleSearch, value, + name, }) { return (
-
+
-
+
diff --git a/src/components/MyWallet/Popup/ConfirmAddFund.jsx b/src/components/MyWallet/Popup/ConfirmAddFund.jsx index 10a672a..b826916 100644 --- a/src/components/MyWallet/Popup/ConfirmAddFund.jsx +++ b/src/components/MyWallet/Popup/ConfirmAddFund.jsx @@ -1,6 +1,6 @@ import { FlutterWaveButton, closePaymentModal } from "flutterwave-react-v3"; import React, { useState } from "react"; -import { useDispatch } from "react-redux"; +import { useDispatch, useSelector } from "react-redux"; import { useNavigate } from "react-router-dom"; import { toast } from "react-toastify"; import usersService from "../../../services/UsersService"; @@ -99,6 +99,9 @@ function ConfirmAddFund({ : __confirmData.card; const apiURL = new usersService(); + + const { userDetails } = useSelector((state) => state?.userDetails); + const navigate = useNavigate(); const dispatch = useDispatch(); @@ -112,7 +115,13 @@ function ConfirmAddFund({ public_key: process.env.REACT_APP_FLUTTERWAVE_APIKEY, tx_ref: Date.now(), currency: "NGN", + amount: Number(__confirmData.amount), payment_options: "card,mobilemoney,ussd", + customer: { + email: userDetails.email, + phone_number: userDetails.phone, + name: `${userDetails.lastname} ${userDetails.firstname}`, + }, customizations: { title: "WrenchBoard", description: "Topup Payment", @@ -132,7 +141,7 @@ function ConfirmAddFund({ const onSuccessPayment = () => { setRequestStatus({ message: "", loading: true, status: false }); - const reqData = { amount: __confirmData?.account, currency: "NGN" }; + const reqData = { amount: Number(__confirmData?.amount), currency: "NGN" }; apiURL .startTopUp(reqData) @@ -151,9 +160,12 @@ function ConfirmAddFund({ status: true, }); toast.success("Account Topup was successful"); - setTimeout(() => { - navigate("/my-wallet", { replace: true }); - }, 1000); + onClose() + dispatch(tableReload({ type: "WALLETTABLE" })); + navigate("/my-wallet", { replace: true }); + // setTimeout(() => { + // navigate("/my-wallet", { replace: true }); + // }, 1000); } }) .catch((err) => { @@ -205,6 +217,7 @@ function ConfirmAddFund({ }, data: _response, })); + dispatch(tableReload({ type: "WALLETTABLE" })); }, 1500); } catch (error) { setConfirmCredit((prev) => ({ @@ -256,7 +269,6 @@ function ConfirmAddFund({ } setTimeout(() => { - dispatch(tableReload({ type: "WALLETTABLE" })); setConfirmCredit((prev) => ({ ...prev, show: { @@ -265,6 +277,7 @@ function ConfirmAddFund({ }, data: _response, })); + dispatch(tableReload({ type: "WALLETTABLE" })); }, 1500); } catch (error) { setConfirmCredit((prev) => ({ @@ -278,7 +291,16 @@ function ConfirmAddFund({ } }; - // console.log(confirmCredit?.data); + const getBack = () => { + setConfirmCredit((prev) => ({ + ...prev, + show: { + awaitConfirm: { loader: false, state: false }, + acceptConfirm: { loader: false, state: false }, + }, + data: {}, + })); + } return (
@@ -348,9 +370,9 @@ function ConfirmAddFund({
{__confirmCountry === "US" && (
+
+ {requestStatus.loading ? + + : +

{requestStatus.message}

+ } +
-
- {/*
-
-
-
*/}
diff --git a/src/components/UserHeader/RecomendedSliders.jsx b/src/components/UserHeader/RecomendedSliders.jsx index cec4982..223fbee 100644 --- a/src/components/UserHeader/RecomendedSliders.jsx +++ b/src/components/UserHeader/RecomendedSliders.jsx @@ -100,7 +100,7 @@ export default function RecomendedSliders({ className, bannerData }) {
{bannerData.map((item, index) => ( - +