diff --git a/src/components/HomeCom.jsx b/src/components/HomeCom.jsx index 63ce8f6..34d1ce1 100644 --- a/src/components/HomeCom.jsx +++ b/src/components/HomeCom.jsx @@ -2,15 +2,15 @@ import { useQuery } from "@tanstack/react-query"; import { useNavigate } from 'react-router-dom' -import { CiPhone } from "react-icons/ci" -import { CiBank } from "react-icons/ci"; -import { MdOutlineEmail } from "react-icons/md" -import { FaMapPin } from "react-icons/fa"; +import { BsCash } from "react-icons/bs"; +import { MdUpdate } from "react-icons/md" +import { FaUser, FaMapPin } from "react-icons/fa"; import { demoUsersList } from "../services/siteServices" import queryKeys from "../services/queryKeys" import myLinks from "../myLinks"; import TableWrapper from "./TableWrapper"; +import formatNumber from "../helpers/formatNumber"; export default function HomeCom() { @@ -56,27 +56,27 @@ export default function HomeCom() {
- + - {user.bvn} + {user.accountid}
- + - {user.mobile} -
-
- - - - {user.email} + {formatNumber(user.balance)}
- {user.pin} + {user.pin} +
+
+ + + + {user.updated}
diff --git a/src/components/loan_screen/payloan/PinRepayment.jsx b/src/components/loan_screen/payloan/PinRepayment.jsx index e37bf23..2609a43 100644 --- a/src/components/loan_screen/payloan/PinRepayment.jsx +++ b/src/components/loan_screen/payloan/PinRepayment.jsx @@ -2,10 +2,12 @@ import React, { useState } from 'react' import { useMutation } from '@tanstack/react-query' import Label from '../../Label' import InputText from '../../InputText' -import { verifyLoan } from '../../../services/siteServices' +import { repayLoan } from '../../../services/siteServices' export default function PinRepayment({step, handleStep, screens}) { + console.log('step', step.activeUser, step.details) + const [isSuccess, setIsSuccess] = useState(false) const [error, setError] = useState('') @@ -19,17 +21,15 @@ export default function PinRepayment({step, handleStep, screens}) { const proceed = useMutation({ mutationFn: () => { - let fields = {pin, bvn:step.activeUser.bvn, loan_application_id:step.details.loan_application_id} + let fields = {pin, loan_id:step.details.selected_loan_id, customerID:step.activeUser.customerid} if(!fields.pin){ throw ({message:'Please enter pin'}) } - // if(isNaN(fields.pin)){ - // throw ({message:'Amount must be a valid figure'}) - // } + if(fields.pin.length != 4){ throw ({message:'Pin must be 4 digits'}) } - return verifyLoan(fields) + return repayLoan(fields) }, onError: (error) => { setError(error.message) @@ -41,14 +41,6 @@ export default function PinRepayment({step, handleStep, screens}) { } }) - const handleClick = (selectedAmount) => { // remove later - if(!pin){ - return setError('Enter Pin') - } - setIsSuccess(true) - // handleStep({selectedAmount}, screens.finished) - } - return ( <> {!isSuccess ? @@ -57,8 +49,7 @@ export default function PinRepayment({step, handleStep, screens}) {

{`Your loan amount due is ${step.details.selectedAmount}`}