diff --git a/src/components/Dashboard/DashboardFormInit.tsx b/src/components/Dashboard/DashboardFormInit.tsx deleted file mode 100644 index 13cdd2f..0000000 --- a/src/components/Dashboard/DashboardFormInit.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import { Button, InputCompOne, Stepper } from ".."; -import {Formik, Form} from 'formik' -import * as Yup from "yup"; - -type Props = { - handleNextStep:(value:{})=>any -} - -const initialValues = { - loan_amount: "", - payment_month: "", - sales_agent: "", -}; - -// To get the validation schema -const validationSchema = Yup.object().shape({ - payment_month: Yup.string() - .required("Required"), - loan_amount: Yup.string() - .required("Required") - .test("no-e", "Invalid", (value:any) => { - if (value && /^[0-9]*$/.test(value) == false) { - return false; - } - return true; - }), - sales_agent: Yup.string() -}); - -export default function DashboardFormInit({handleNextStep}:Props) { - - //FUNCTION TO HANDLE SUBMIT - const handleSubmit = (values:{}) => { - handleNextStep(values) - }; - - return ( -
-
- -
- - {(props)=>( -
-
- - - -
-
- )} -
-
- ); -} - -interface SelectOption { - loading: boolean; - data: {value: string; - label: string}[] -} - - -const paymentMonth: SelectOption = { - loading: false, - data: [ - { value: "", label: "Please Select" }, - { value: "6", label: "6 Months" }, - { value: "12", label: "12 Months" }, - { value: "18", label: "18 Months" }, - { value: "24", label: "24 Months" }, - ] -} diff --git a/src/components/Dashboard/DashboardHome.tsx b/src/components/Dashboard/DashboardHome.tsx deleted file mode 100644 index 79bc66e..0000000 --- a/src/components/Dashboard/DashboardHome.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import React, { FC } from "react"; -import DashboardHomeIntro from "./DashboardHomeIntro"; -import DashboardFormInit from "./DashboardFormInit"; -import DashboardHomeDetail from "./home/DashboardHomeDetail"; -import DashboardHomeEmploymentInfo from "./home/DashboardHomeEmploymentInfo"; -import DashboardHomeRefereeInfo from "./home/DashboardHomeRefereeInfo"; -import DashboardHomeAttestation from "./home/DashboardHomeAttestation"; - -interface DashboardHomeProps {} - -const DashboardHome: FC = () => { - const [step, setStep] = React.useState(1); - const [applicationDetails, setApplicationDetails] = React.useState({}); - - const handleNextStep = (values:{}={}) => { - if (step < 7) { - setStep(step + 1); - } - setApplicationDetails((prev:{}) => ({...prev, ...values})) - } - - return ( -
- {step === 1 && } - {step === 2 && } - {step === 3 && } - {step === 4 && } - {step === 5 && } - {step === 6 && } - {step === 7 && } - {/* */} -
- ); -}; - -export default DashboardHome; diff --git a/src/components/Dashboard/DashboardHomeIntro.tsx b/src/components/Dashboard/DashboardHomeIntro.tsx deleted file mode 100644 index 26648f5..0000000 --- a/src/components/Dashboard/DashboardHomeIntro.tsx +++ /dev/null @@ -1,269 +0,0 @@ -import React, { FC, useState, useEffect } from 'react'; -import NairaBag from '../../assets/images/dashboard/naira-bag.png'; -import { Button, Icons } from '../'; -import { useSelector } from 'react-redux'; -import PendingList from '../paginated-list/PendingList'; -import { PendingTableList } from '../../core/models'; -import { NewDateTimeFormatter } from '../../lib/NewDateTimeFormatter'; -import { getUserPendingLoanList } from '../../core/apiRequest'; - -export interface DashBoardCardProps { - title?: string; - desc?: string; - descSpan?: string; - descSpanClass?: string; - onClick?: any; - cardClass?: string; - titleClass?: string; - descClass?: string; - btnTitle?: string; - btnTextClass?: string; - image?: any; - imgClass?: string; -} - -export const DashBoardCard: React.FC = ({ - title, - desc, - onClick, - cardClass, - titleClass, - descClass, - descSpan, - descSpanClass, - btnTitle, - btnTextClass, - image, - imgClass, -}) => { - return ( -
-
- {title && ( -

- {title} -

- )} - {desc && ( -

- {desc}{' '} - {descSpan && ( - - {descSpan} - - )} -

- )} - {btnTitle && ( -
- {image && card-image} -
- ); -}; - -interface DashboardHomeIntroProps { - handleNextStep: (value: {}) => any; - step?: number | string; -} - -const DashboardHomeIntro: FC = ({ - handleNextStep, - step, -}) => { - const { userDetails } = useSelector((state: any) => state?.userDetails); // CHECKS IF USER Details are avaliable - - const [userLoanList, setUserLoanList] = useState<{ - loading: boolean; - data: PendingTableList; - }>({ loading: true, data: [] }); - - useEffect(() => { - let token = localStorage.getItem('token'); - let uid = localStorage.getItem('uid'); - if (!token || !uid) { - return; - } - getUserPendingLoanList(uid) - .then((res) => { - console.log('RES', res); - console.log('RES', userLoanList); - if (!res || !res.data.loans) { - setUserLoanList({ loading: false, data: [] }); - return; - } - setUserLoanList({ loading: false, data: res?.data?.loans }); - }) - .catch((err) => { - console.log(err); - setUserLoanList({ loading: false, data: [] }); - }); - }, []); - - return ( -
- {step == 1 ? ( - <> -

- Hello, {userDetails.firstname} -

-
- handleNextStep({})} - /> -
- - ) : ( - <> -

- Welcome Back, {userDetails.firstname} -

-
- -
- - )} - {userLoanList.loading ? null : ( -
- - {(data: any) => ( -
- - - - - - - - - - - - {data.map((item: any, index: any) => ( - - - - - - - - ))} - -
DateAmount - Payment Term - StatusAction
- {NewDateTimeFormatter(item?.added)} - - {item?.loan_amount} - - {item?.payment_month} - - {item?.status} - - -
-
- )} -
-
- )} -
- ); -}; - -export default DashboardHomeIntro; - -// {/*
-// { -// console.log("working"); -// }} -// /> -//
*/} - -// {/*
-//
-// { -// console.log("working"); -// }} -// /> -//
-//
-// { -// console.log("working"); -// }} -// /> -//
-//
-// { -// console.log("working"); -// }} -// /> -//
-//
*/} diff --git a/src/components/Dashboard/DashboardProfile.tsx b/src/components/Dashboard/DashboardProfile.tsx deleted file mode 100644 index 33e187f..0000000 --- a/src/components/Dashboard/DashboardProfile.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { InputCompOne } from ".."; - -import { useNavigate } from "react-router-dom"; -import { RouteHandler } from "../../router/routes"; - -export default function DashboardProfile() { - let navigate = useNavigate(); - const navigateToProfile = () => navigate(RouteHandler.dashboardHome); - return ( -
-
- -
-
- - - - - - -
-
- ); -} diff --git a/src/components/Dashboard/home/DashboardHomeAttestation.tsx b/src/components/Dashboard/home/DashboardHomeAttestation.tsx deleted file mode 100644 index c2cae7a..0000000 --- a/src/components/Dashboard/home/DashboardHomeAttestation.tsx +++ /dev/null @@ -1,147 +0,0 @@ -import { Button, InputCompOne, Stepper } from '../../shared/index'; - -import {Formik, Form} from 'formik' -import * as Yup from "yup"; -import { applyForLoan } from '../../../core/apiRequest'; - -// import { useNavigate } from "react-router-dom"; -// import { RouteHandler } from '../../../router/routes'; - -type Props = { - handleNextStep:(value:{})=>any - applicationDetails: {} -} - -const initialValues = { - account: "", - checked: false -}; - -// To get the validation schema -const validationSchema = Yup.object().shape({ - account: Yup.string() - .required("Required"), - checked: Yup.bool() // use bool instead of boolean - .oneOf([true], "You must accept the terms and conditions") -}); - -export default function DashboardHomeAttestation({handleNextStep, applicationDetails}:Props) { - // let navigate = useNavigate(); - // const navigateToProfile = () => navigate(RouteHandler.dashboardProfile); - - //FUNCTION TO HANDLE LOAN APPLICATION - const handleSubmit = (values:any) => { - delete values.checked - applyForLoan({...applicationDetails, disbursement: values}).then(res=>{ - console.log('APPLY FOR LOAN', res) - handleNextStep({disbursement: values}) - console.log('ApplicationDetails', {...applicationDetails, disbursement: values}) - }).catch(err=>{ - console.log(err) - }) - // applyForLoan(payload).then(res=>{ - // console.log('APPLY FOR LOAN', res) - // // handleNextStep({disbursement: values}) - // }).catch(err=>{ - // console.log(err) - // }) - }; - - return ( -
-
- -
-

Applicant's Attestation and Debit Instruction

-

NB: Must be your FCMB account number

- - {(props)=>( -
-
-
- -
-
-
- -

By pressing, you agree that you have read, understood and accept the applicatant's attestation and terms and conditions for FCMB - premium salary loan. You also give us permission to collect financial information and run credit checks on the account provided through our partners -

-
- {props.errors.checked && props.touched.checked && {props.errors.checked}} -
-
-
- )} -
-
- ); -} - - -// const payload = { -// "loan_amount": "100000", -// "payment_month": "18", -// "sales_agent": "Testing1234", -// "gender": "male", -// "address": "World bank housing Estate, Umuahia", -// "marital_status": "single", -// "state": "abia", -// "email": "test5070@gmail.com", -// "country": "NG", -// "employment": { -// "job_title": "Information Officer", -// "name": "Testing Testing", -// "sector": "private (non academic)", -// "industry": "engineering", -// "resumption_date": "2024-04-05", -// "email": "test50700@gmail.com", -// "annual_income": "600000", -// "monthly_salary": "50000", -// "salary_payment_date": "2024-04-19", -// "employment_id": "2555566", -// "highest_eductaion": "b.sc + professional qualification" -// }, -// "loan_reference": [ -// { -// "fullname": "John Mike", -// "relationship": "Brother", -// "phone_number": "07055566611", -// "email": "refone@gmail.com", -// "bvn": "11111111111" -// }, -// { -// "fullname": "Mary Paul", -// "relationship": "Brother", -// "phone_number": "07055577711", -// "email": "reftwo@gmail.com", -// "bvn": "22222222222" -// } -// ], -// disbursement:{account: '1122334456'} -// } \ No newline at end of file diff --git a/src/components/Dashboard/home/DashboardHomeDetail.tsx b/src/components/Dashboard/home/DashboardHomeDetail.tsx deleted file mode 100644 index 3097b18..0000000 --- a/src/components/Dashboard/home/DashboardHomeDetail.tsx +++ /dev/null @@ -1,190 +0,0 @@ -import { Button, InputCompOne, Stepper } from '../../shared/index'; - -import {Formik, Form} from 'formik' -import * as Yup from "yup"; - -type Props = { - handleNextStep:(value:{})=>any -} - -const initialValues = { - gender: "", - address: "", - marital_status: "", - state: "", - email:"", - country:"" -}; - -// To get the validation schema -const validationSchema = Yup.object().shape({ - gender: Yup.string() - .required("Required"), - address: Yup.string() - .required("Required"), - marital_status: Yup.string() - .required("Required"), - state: Yup.string() - .required("Required"), - email: Yup.string() - .email("Invalid") - .required("Required"), - country: Yup.string() - .required("Required"), -}); - -export default function DashboardHomeDetail({handleNextStep}:Props) { - - //FUNCTION TO HANDLE SUBMIT - const handleSubmit = (values:any) => { - handleNextStep(values) - }; - - return ( -
-
- -
- - {(props)=>( -
-
-
- - -
-
- - -
-
- - -
-
-
- )} -
-
- ); -} - -interface SelectOption { - loading: boolean; - data: {value: string; - label: string}[] -} - - -const gender: SelectOption = { - loading: false, - data: [ - { value: "", label: "Please Select" }, - { value: "male", label: "Male" }, - { value: "female", label: "Female" }, - { value: "others", label: "Prefer not to say" }, - ] -} - -const maritalStatus: SelectOption = { - loading: false, - data: [ - { value: "", label: "Please Select" }, - { value: "single", label: "Single" }, - { value: "married", label: "Married" }, - { value: "divorced", label: "Divorced" }, - ] -} - -const state: SelectOption = { - loading: false, - data: [ - { value: "", label: "Please Select" }, - { value: "abia", label: "Abia" }, - { value: "imo", label: "Imo" }, - { value: "lagos", label: "Lagos" }, - ] -} - -const country: SelectOption = { - loading: false, - data: [ - { value: "", label: "Please Select" }, - { value: "NG", label: "Nigeria" }, - ] -} \ No newline at end of file diff --git a/src/components/Dashboard/home/DashboardHomeEmploymentInfo.tsx b/src/components/Dashboard/home/DashboardHomeEmploymentInfo.tsx deleted file mode 100644 index 946f521..0000000 --- a/src/components/Dashboard/home/DashboardHomeEmploymentInfo.tsx +++ /dev/null @@ -1,353 +0,0 @@ -import {useState, useEffect} from 'react' -import { Button, InputCompOne, Stepper } from '../../shared/index'; - -import {Formik, Form} from 'formik' -import * as Yup from "yup"; - -import { getEmployersList } from '../../../core/apiRequest'; - -type Props = { - handleNextStep:(value:{})=>any -} - -// type EmployerProps = { -// loading?: boolean, -// data?: Array<{[index:string]: string}> | {[index:string]: Array<{[index:string]: string}> } -// } - -const initialValues = { - job_title: "", - name: "", - sector: "", - industry: "", - resumption_date: "", - email:"", - annual_income: "", - monthly_salary: "", - salary_payment_date: "", - employment_id: "", - highest_eductaion: "", - employer_uid: "", - isChecked: false -}; - -// To get the validation schema -const validationSchema = Yup.object().shape({ - isChecked: Yup.bool(), // use bool instead of boolean - // .oneOf([true, false], "You must accept the terms and conditions"), - job_title: Yup.string() - .required("Required"), - name: Yup.string().when('isChecked', { - is: true, - then: () => Yup.string().required('required'), - otherwise: () => Yup.string(), - }), - sector: Yup.string().when('isChecked', { - is: true, - then: () => Yup.string().required('required'), - }), - industry: Yup.string().when('isChecked', { - is: true, - then: () => Yup.string().required('required'), - }), - resumption_date: Yup.string() - .required("Required"), - email: Yup.string().when('isChecked', { - is: true, - then: () => Yup.string().required('required'), - }) - .email("Invalid"), - annual_income: Yup.string() - .required("Required") - .test("no-e", "Invalid", (value:any) => { - if (value && /^[0-9]*$/.test(value) == false) { - return false; - } - return true; - }), - monthly_salary: Yup.string() - .required("Required") - .test("no-e", "Invalid", (value:any) => { - if (value && /^[0-9]*$/.test(value) == false) { - return false; - } - return true; - }), - salary_payment_date: Yup.string() - .required("Required"), - employment_id: Yup.string() - .required("Required"), - highest_eductaion: Yup.string() - .required("Required"), - employer_uid: Yup.string().when('isChecked', { - is: false, - then: () => Yup.string().required('required'), - }), -}); - -export default function DashboardHomeEmploymentInfo({handleNextStep}:Props) { - - const [employersList, setEmployersList] = useState({ - loading: true, - data: [] - }) - - - //FUNCTION TO HANDLE SUBMIT - const handleSubmit = (values:any) => { - // Remember to changed the checked value's name - if(values.employer_uid){ - let employer_uid = values.employer_uid - delete values.employer_uid - handleNextStep({employer_uid, employment: values}) - }else{ - handleNextStep({employment: values}) - } - }; - - useEffect(()=>{ - getEmployersList().then(res => { - setEmployersList({loading:false, data:res?.data}) - }).catch(err => { - console.log(err) - setEmployersList({loading:false, data:[]}) - }) - },[]) - - - return ( -
-
- -
- - {(props)=>( -
-
-

Employment Informaton

-
-
-
- -
- -

Check here if employer is not on the list

-
-
- Name: {'Name'} -
-
-
- - - - -
-
- -
- - -
- - -
-
- - -
- -
-
-
-
-
-
- )} -
-
- ); -} - - - -interface SelectOption { - loading: boolean; - data: {value: string; - label: string}[] -} - - -const jobSector: SelectOption = { - loading: false, - data: [ - { value: "", label: "Please Select" }, - { value: "private (non academic)", label: "Private (non academic)" }, - ] -} - -const industry: SelectOption = { - loading: false, - data: [ - { value: "", label: "Please Select" }, - { value: "engineering", label: "Engineering" }, - ] -} - -const highestEductaion: SelectOption = { - loading: false, - data: [ - { value: "", label: "Please Select" }, - { value: "b.sc + professional qualification", label: "B.Sc + Professional Qualification" }, - ] -} \ No newline at end of file diff --git a/src/components/Dashboard/home/DashboardHomeRefereeInfo.tsx b/src/components/Dashboard/home/DashboardHomeRefereeInfo.tsx deleted file mode 100644 index ee00a6b..0000000 --- a/src/components/Dashboard/home/DashboardHomeRefereeInfo.tsx +++ /dev/null @@ -1,244 +0,0 @@ -import { Button, InputCompOne, Stepper } from '../../shared/index'; - -import {Formik, Form} from 'formik' -import * as Yup from "yup"; - -type Props = { - handleNextStep:(value:{})=>any -} - -const initialValues = { - ref_name: "", - ref_email: "", - ref_phone_number: "", - ref_relationship: "", - ref_bvn: "", - ref_two_name: "", - ref_two_email: "", - ref_two_phone_number: "", - ref_two_relationship: "", - ref_two_bvn: "", -}; - -// To get the validation schema -const validationSchema = Yup.object().shape({ - ref_name: Yup.string() - .required("Required"), - ref_email: Yup.string() - .email("Invalid") - .required("Required"), - ref_phone_number: Yup.string() - .required("Required"), - ref_relationship: Yup.string() - .required("Required"), - ref_bvn: Yup.string() - .required("BVN is required") - .test("no-e", "Invalid number", (value:any) => { - if (value && /^[0-9]*$/.test(value) == false) { - return false; - } - return true; - }) - .min(11, "must be 11 digits") - .max(11, "must be 11 digits"), - ref_two_name: Yup.string() - .required("Required"), - ref_two_email: Yup.string() - .email("Invalid") - .required("Required"), - ref_two_phone_number: Yup.string() - .required("Required"), - ref_two_relationship: Yup.string() - .required("Required"), - ref_two_bvn: Yup.string() - .required("BVN is required") - .test("no-e", "Invalid number", (value:any) => { - if (value && /^[0-9]*$/.test(value) == false) { - return false; - } - return true; - }) - .min(11, "must be 11 digits") - .max(11, "must be 11 digits"), -}); - -export default function DashboardHomeRefereeInfo({handleNextStep}:Props) { - - //FUNCTION TO HANDLE SUBMIT - const handleSubmit = (values:any) => { - let refOne = { - fullname: values.ref_name, - relationship: values.ref_relationship, - phone_number: values.ref_phone_number, - email: values.ref_email, - bvn: values.ref_bvn - } - let refTwo = { - fullname: values.ref_two_name, - relationship: values.ref_two_relationship, - phone_number: values.ref_two_phone_number, - email: values.ref_two_email, - bvn: values.ref_two_bvn - } - handleNextStep({loan_reference:[refOne, refTwo]}) - }; - - - return ( -
-
- -
- - {(props)=>( -
-
-

Reference Details (Must be 18 years and above)

-
-
-

Reference one

-
- - - - - -
-
-
-

Reference two

-
- - - - - -
-
-
-
-
- )} -
-
- ); -} diff --git a/src/components/Dashboard/index.tsx b/src/components/Dashboard/index.tsx deleted file mode 100644 index e26e6ca..0000000 --- a/src/components/Dashboard/index.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import DashboardHome from './DashboardHome' -import DashboardProfile from './DashboardProfile'; - -export { DashboardHome, DashboardProfile }; \ No newline at end of file diff --git a/src/components/GetStarted/DebitAccount.tsx b/src/components/GetStarted/DebitAccount.tsx index 22fbaa3..ed2f2fa 100644 --- a/src/components/GetStarted/DebitAccount.tsx +++ b/src/components/GetStarted/DebitAccount.tsx @@ -34,7 +34,7 @@ const DebitAccount: React.FC = () => { //FUNCTION TO HANDLE SUBMIT const handleSubmit = (values:any) => { console.log(values) - navigate(RouteHandler.letsGetStarted, {replace:true}) + navigate('', {replace:true}) }; return ( diff --git a/src/components/LetsGetStated/LetsGetStarted.tsx b/src/components/LetsGetStated/LetsGetStarted.tsx deleted file mode 100644 index b08495e..0000000 --- a/src/components/LetsGetStated/LetsGetStarted.tsx +++ /dev/null @@ -1,260 +0,0 @@ -import React from 'react'; -import * as Yup from 'yup'; -import { Form, Formik } from 'formik'; -import { InputCompOne } from '..'; -import { useNavigate } from 'react-router-dom'; -import { RouteHandler } from '../../router/routes'; - -import { useDispatch } from 'react-redux'; -import { updateUserDetails } from '../../store/UserDetails'; - -import { validateBVN, verifyOTP } from '../../core/apiRequest'; -import { RequestStatus } from '../../core/models'; - -// To get the validation schema -const validationSchema = Yup.object().shape({ - bvn: Yup.string() - .required('BVN is required') - .test('no-e', 'Invalid number', (value: any) => { - if (value && /^[0-9]*$/.test(value) == false) { - return false; - } - return true; - }) - .min(11, 'must be 11 digits') - .max(11, 'must be 11 digits'), - otp: Yup.string() - // .when('require_otp', { - // is: true, - // then: Yup.string().required("OTP is required") - // }) - // .required("OTP is required") - .test('no-e', 'Invalid number', (value: any) => { - if (value && /^[0-9]*$/.test(value) == false) { - return false; - } - return true; - }) - .min(5, 'must be 5 digits') - .max(5, 'must be 5 digits'), - // .test("no-e", "must be 11 characters", (value:any) => { - // if (value.length < 11) { - // return false; - // } - // return true; - // }) -}); - -// initial values for formik -let initialValues = { - bvn: '', - otp: '', -}; - -type ValidBVN = { - verification_id: string; - valid: undefined | boolean; -}; - -const LetsGetStarted: React.FC = () => { - const dispatch = useDispatch(); - const navigate = useNavigate(); - // const [pinValues, setPinValues] = React.useState({ - // bvn: "", - // otp: "", - // }); - // const otpInputRef = React.useRef(null); - - const [requestStatusBVN, setRequestStatusBVN] = React.useState( - { loading: false, status: undefined, message: '' } - ); - - const [requestStatusOTP, setRequestStatusOTP] = React.useState( - { loading: false, status: undefined, message: '' } - ); - - const [bvnIsValid, setBvnIsValid] = React.useState({ - verification_id: '', - valid: undefined, - }); - - // e: React.FormEvent - // let { value } = e.target as HTMLInputElement; - const bvnValidation = (values: any) => { - // Function to Validate BVN - let bvn = values.bvn; - setRequestStatusBVN({ loading: true, status: false, message: '' }); - validateBVN({ bvn }) - .then((res) => { - if (!res || !res.data.call_return) { - setBvnIsValid({ verification_id: '', valid: false }); - setRequestStatusBVN({ - loading: false, - status: false, - message: 'unable to verify BVN', - }); - return setTimeout(() => { - setRequestStatusBVN({ loading: false, status: false, message: '' }); - }, 4000); - } - setBvnIsValid({ - verification_id: res.data.verification_id, - valid: true, - }); - setRequestStatusBVN({ - loading: false, - status: true, - message: 'verified', - }); - }) - .catch((err) => { - setBvnIsValid({ verification_id: '', valid: false }); - console.log(err); - }); - }; - - const handleSubmit = (values: any) => { - // Function to VERIFY OTP AND LOGIN USER - setRequestStatusOTP({ loading: true, status: false, message: '' }); - // console.log('values', values) - verifyOTP({ ...values, verification_id: bvnIsValid.verification_id }) - .then((res) => { - if (!res || !res.data.call_return) { - setRequestStatusOTP({ - loading: false, - status: false, - message: 'wrong otp', - }); - return setTimeout(() => { - setRequestStatusOTP({ loading: false, status: false, message: '' }); - }, 4000); - } - // console.log(res.data) - localStorage.setItem('token', res.data?.token); - localStorage.setItem('uid', res?.data?.customer[0]?.uid); - dispatch(updateUserDetails({ ...res?.data?.customer[0] })); - navigate(RouteHandler.dashboardHome, { replace: true }); - }) - .catch((err) => { - setRequestStatusOTP({ - loading: false, - status: false, - message: 'something went wrong, try again', - }); - console.log(err); - return setTimeout(() => { - setRequestStatusOTP({ loading: false, status: false, message: '' }); - }, 4000); - }); - }; - - return ( - - {(props: any) => ( -
-
-
-
-

- Let’s Get You Started -

-
-
-
- -

- {requestStatusBVN.loading - ? 'verifying...' - : requestStatusBVN.message} -

-
- {bvnIsValid.valid && ( - - )} - - -

- {requestStatusOTP.message} -

- - {bvnIsValid.valid || bvnIsValid.valid == undefined ? ( -

- ***Every personal information attached to your BVN is safe - and secure. It is only important for us to verify your - information and also give you access to your application - profile/account. -

- ) : ( -

- ***Did not receive OTP? Click to resend -

- )} -
-
-
-
- )} -
- ); -}; - -export default LetsGetStarted; diff --git a/src/components/LetsGetStated/LetsGetStartedNav.tsx b/src/components/LetsGetStated/LetsGetStartedNav.tsx deleted file mode 100644 index e4116f6..0000000 --- a/src/components/LetsGetStated/LetsGetStartedNav.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from "react"; -import { Link } from "react-router-dom"; -import Logo from "../../assets/icons/logo.svg"; - - -const LetsGetStartedNav: React.FC = () => { - return ( -
-
- - Logo - -
-
- ); -}; - -export default LetsGetStartedNav; diff --git a/src/components/LetsGetStated/index.ts b/src/components/LetsGetStated/index.ts deleted file mode 100644 index 35c2c03..0000000 --- a/src/components/LetsGetStated/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import LetsGetStarted from "./LetsGetStarted"; -import LetsGetStartedNav from "./LetsGetStartedNav"; - -export { LetsGetStarted, LetsGetStartedNav }; diff --git a/src/components/auth/OTP.tsx b/src/components/auth/OTP.tsx index c8eff87..d6da8f4 100644 --- a/src/components/auth/OTP.tsx +++ b/src/components/auth/OTP.tsx @@ -1,6 +1,7 @@ import { useState } from "react"; import { Button, FloatLabelInput } from ".."; -// import { Link } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; +import { RouteHandler } from "../../router/routes"; type FormType = { email: string; @@ -13,6 +14,8 @@ type HandleChange = { }; export default function Login() { + const navigate = useNavigate() + let [formDetails, setFormDetails] = useState({ email: "", password: "", @@ -26,6 +29,11 @@ export default function Login() { setFormDetails((prev) => ({ ...prev, [name]: value })); }; + const handleSubmit = () => { + localStorage.setItem('token', 'dummy') + navigate(RouteHandler.homepage, {replace:true}) + } + return (
@@ -98,6 +106,7 @@ export default function Login() {
diff --git a/src/components/index.ts b/src/components/index.ts index 5ed0e38..9a501f3 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -3,9 +3,6 @@ export * from "./Home"; export * from "./GetStarted"; export * from "./shared"; export * from "./Footer"; -// export * from "./DashboardLayout"; export * from "./Icons"; -export * from "./Dashboard"; export * from "./Cards"; -export * from "./LetsGetStated"; export * from "./TsAndCs"; diff --git a/src/core/apiRequest.ts b/src/core/apiRequest.ts index ce5555b..6ba6260 100644 --- a/src/core/apiRequest.ts +++ b/src/core/apiRequest.ts @@ -1,51 +1,18 @@ import { postAuxEnd, getAuxEnd } from "./axiosCall"; // FUNCTION TO START BVN VALIDATION -export const validateBVN = (postData:any) => { - let reqData = { - ...postData - } - return postAuxEnd('/bvn', reqData) -} +// export const validateBVN = (postData:any) => { +// let reqData = { +// ...postData +// } +// return postAuxEnd('/bvn', reqData) +// } // FUNCTION TO VERIFY OTP AND LOGIN -export const verifyOTP = (postData:any) => { - let reqData = { - ...postData - } - return postAuxEnd('/bvn/verify', reqData) -} - -// FUNCTION TO APPLY FOR LOAN -export const applyForLoan = (postData:any) => { - let reqData = { - customer_uid: localStorage.getItem('uid'), - ...postData - } - return postAuxEnd('/loan/apply', reqData) -} - -// FUNCTION TO GET USER BY CUSTOMER UID -export const getUserByID = (uid:string) => { - let reqData = { - // customer_uid: localStorage.getItem('uid'), - } - return getAuxEnd(`/profile?uid=${uid}`, reqData) -} - -// FUNCTION TO GET USER BY CUSTOMER UID -export const getUserPendingLoanList = (uid:string) => { - let reqData = { - // customer_uid: localStorage.getItem('uid'), - } - return getAuxEnd(`/dash?uid=${uid}`, reqData) -} - -// FUNCTION TO GET LIST OF EMPLOYERS -export const getEmployersList = () => { - let reqData = { - // customer_uid: localStorage.getItem('uid'), - } - return getAuxEnd(`/employers`, reqData) -} \ No newline at end of file +// export const verifyOTP = (postData:any) => { +// let reqData = { +// ...postData +// } +// return postAuxEnd('/bvn/verify', reqData) +// } \ No newline at end of file diff --git a/src/layouts/DashboardLayout/DashboardAuth.tsx b/src/layouts/DashboardLayout/DashboardAuth.tsx index 40641b0..950214e 100644 --- a/src/layouts/DashboardLayout/DashboardAuth.tsx +++ b/src/layouts/DashboardLayout/DashboardAuth.tsx @@ -1,11 +1,11 @@ import {useState, useEffect} from 'react' -import DashboardLayout from "./DashboardLayout"; +import Layout from '../Layout'; +// import DashboardLayout from "./DashboardLayout"; import { Outlet, useNavigate } from "react-router-dom"; import { useSelector, useDispatch } from "react-redux"; -// import { RouteHandler } from '../../router/routes'; import { updateUserDetails } from '../../store/UserDetails'; -import { getUserByID } from '../../core/apiRequest'; +import { RouteHandler } from '../../router/routes'; import Logo from '../../assets/images/logo.png' @@ -19,25 +19,35 @@ export default function DashboardAuth() { const [loading, setLoading] = useState(true) useEffect(()=>{ + // let token = localStorage.getItem('token') + // let uid = localStorage.getItem('uid') + // if(!token || !uid){ // IF NO TOKEN || UID RETURN TO LOGIN PAGE + // navigate(RouteHandler.homepage, {replace:true}) + // return + // } + // const getUser = () => { // FUNCTION TO GET USER BY ID + // getUserByID(uid).then(res=>{ + // if(!res.data.call_return || !Object.keys(res.data.customer).length){ + // navigate('', {replace:true}) + // return + // } + // setLoading(false) + // dispatch(updateUserDetails(res.data.customer)); + // }).catch(err=>{ + // navigate('', {replace:true}) + // console.log('USER ERROR', err) + // }) + // } + let token = localStorage.getItem('token') - let uid = localStorage.getItem('uid') - if(!token || !uid){ - navigate('', {replace:true}) + if(!token){ // IF NO TOKEN || UID RETURN TO LOGIN PAGE + navigate(RouteHandler.loginpage, {replace:true}) return } const getUser = () => { // FUNCTION TO GET USER BY ID - // let data = {firstname:'firstname', lastname:'lastname', uid:'28273737646466464'} - getUserByID(uid).then(res=>{ - if(!res.data.call_return || !Object.keys(res.data.customer).length){ - navigate('', {replace:true}) - return - } - setLoading(false) - dispatch(updateUserDetails(res.data.customer)); - }).catch(err=>{ - navigate('', {replace:true}) - console.log('USER ERROR', err) - }) + let data = {firstname:'firstname', lastname:'lastname', uid:'28273737646466464'} + setLoading(false) + dispatch(updateUserDetails(data)); } if(!Object.keys(userDetails).length){ getUser() @@ -52,9 +62,9 @@ export default function DashboardAuth() {

loading...

: - + - + } ) diff --git a/src/layouts/LetsGetStartedLayout.tsx b/src/layouts/LetsGetStartedLayout.tsx deleted file mode 100644 index cbf43a6..0000000 --- a/src/layouts/LetsGetStartedLayout.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import React from "react"; -import { Footer, LetsGetStartedNav } from "../components"; -// import layoutImage from "../assets/images/test1-reverse.png"; - -const LetsGetStartedLayout = ({ children }: { children: React.ReactNode }) => { - return ( -
-
-
- - {children} -
-
- {/* */} -
-
-
-
-
-
- ); -}; - -export default LetsGetStartedLayout; diff --git a/src/layouts/index.ts b/src/layouts/index.ts index 5267d35..9a56fb9 100644 --- a/src/layouts/index.ts +++ b/src/layouts/index.ts @@ -1,7 +1,6 @@ import HomeLayout from "./HomeLayout"; -import LetsGetStartedLayout from "./LetsGetStartedLayout"; import Layout from "./Layout"; import DashboardLayout from "./DashboardLayout/DashboardLayout"; import { DashboardAuth } from "./DashboardLayout"; -export { HomeLayout, LetsGetStartedLayout, Layout, DashboardLayout, DashboardAuth }; +export { HomeLayout, Layout, DashboardLayout, DashboardAuth }; diff --git a/src/pages/DashboardHomePage.tsx b/src/pages/DashboardHomePage.tsx deleted file mode 100644 index 7b02b80..0000000 --- a/src/pages/DashboardHomePage.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { DashboardHome } from "../components" - -export default function DashboardHomePage() { - return ( -
- -
- ) -} diff --git a/src/pages/DashboardLegalsPage.tsx b/src/pages/DashboardLegalsPage.tsx deleted file mode 100644 index 5101c4f..0000000 --- a/src/pages/DashboardLegalsPage.tsx +++ /dev/null @@ -1,5 +0,0 @@ -export default function DashboardLegalsPage() { - return ( -
DashboardLegals
- ) -} diff --git a/src/pages/DashboardPaymentsPage.tsx b/src/pages/DashboardPaymentsPage.tsx deleted file mode 100644 index 52e80af..0000000 --- a/src/pages/DashboardPaymentsPage.tsx +++ /dev/null @@ -1,5 +0,0 @@ -export default function DashboardpaymentsPage() { - return ( -
Dashboardpayments
- ) -} diff --git a/src/pages/DashboardProfilePage.tsx b/src/pages/DashboardProfilePage.tsx deleted file mode 100644 index 5f8c8ae..0000000 --- a/src/pages/DashboardProfilePage.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { DashboardProfile } from "../components"; - -export default function DashboardProfilePage() { - return ( - <> - - - ); -} diff --git a/src/pages/DashboardVerificationPage.tsx b/src/pages/DashboardVerificationPage.tsx deleted file mode 100644 index 65b9262..0000000 --- a/src/pages/DashboardVerificationPage.tsx +++ /dev/null @@ -1,5 +0,0 @@ -export default function DashboardVerificationPage() { - return ( -
DashboardVerification
- ) -} diff --git a/src/pages/LetsGetStatedPage.tsx b/src/pages/LetsGetStatedPage.tsx deleted file mode 100644 index f8bd80d..0000000 --- a/src/pages/LetsGetStatedPage.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import React from "react"; -import { LetsGetStartedLayout } from "../layouts"; -import { LetsGetStarted } from "../components"; - -const LetsGetStatedPage: React.FC = () => { - return ( - - - - ); -}; - -export default LetsGetStatedPage; diff --git a/src/pages/StartValidationPage.tsx b/src/pages/StartValidationPage.tsx index eca9900..86246d6 100644 --- a/src/pages/StartValidationPage.tsx +++ b/src/pages/StartValidationPage.tsx @@ -1,14 +1,14 @@ -import React from "react"; +import React, { useEffect } from "react"; import { StartValidation } from "../components"; -import { Layout } from "../layouts"; const StartValidationPage: React.FC = () => { + useEffect(()=>{ // remove this function later + localStorage.clear() + },[]) return ( <> - - - + ); }; diff --git a/src/pages/index.ts b/src/pages/index.ts index 4d1a97b..0496109 100644 --- a/src/pages/index.ts +++ b/src/pages/index.ts @@ -2,11 +2,6 @@ import HomePage from "./HomePage"; import LoginPage from "./LoginPage"; import OTPPage from "./OTPPage"; import StartValidationPage from "./StartValidationPage"; -// import DashboardHomePage from "./DashboardHomePage"; -// import DashboardLegalsPage from "./DashboardLegalsPage"; -// import DashboardProfilePage from "./DashboardProfilePage"; -// import DashboardVerificationPage from "./DashboardVerificationPage"; -// import DashboardpaymentsPage from "./DashboardPaymentsPage"; // import TermsAndConditionPage from "./TermsAndConditionPage"; // import PersonalBankingPage from "./PersonalBankingPage"; // import BusinessBankingPage from "./BusinessBankingPage"; @@ -18,11 +13,6 @@ export { LoginPage, OTPPage, StartValidationPage, - // DashboardHomePage, - // DashboardLegalsPage, - // DashboardProfilePage, - // DashboardVerificationPage, - // DashboardpaymentsPage, // TermsAndConditionPage, // PersonalBankingPage, // BusinessBankingPage, diff --git a/src/router/Router.tsx b/src/router/Router.tsx index da16509..282779a 100644 --- a/src/router/Router.tsx +++ b/src/router/Router.tsx @@ -7,16 +7,10 @@ import { LoginPage, OTPPage, // HomePage, - // DashboardHomePage, - // DashboardLegalsPage, - // DashboardProfilePage, - // DashboardVerificationPage, - // DashboardpaymentsPage, // TermsAndConditionPage, // BusinessBankingPage, // CooperateBankingPage, // PersonalBankingPage, - // LetsGetStatedPage, } from "../pages"; const Routers = () => { @@ -27,52 +21,10 @@ const Routers = () => { } /> - } /> - - {/* } /> */} - {/* } - /> - } - /> - } - /> - } - /> - } - /> */} {/* Dashboard */} }> - {/* } - /> - } - /> - } - /> - } - /> - } - /> */} + } /> Error Page} />