Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 18967d720c | |||
| 044b2ef917 | |||
| 4f7fdfb2ba | |||
| ab389d6632 | |||
| 29538e3b6e | |||
| dd2df0d695 | |||
| a97db9a661 | |||
| 135cbce348 |
@@ -25,7 +25,6 @@ const validationSchema = Yup.object().shape({
|
|||||||
return true;
|
return true;
|
||||||
}),
|
}),
|
||||||
sales_agent: Yup.string()
|
sales_agent: Yup.string()
|
||||||
.required("Required")
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function DashboardFormInit({handleNextStep}:Props) {
|
export default function DashboardFormInit({handleNextStep}:Props) {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ const Header: React.FC<HiddenMenuItems> = ({
|
|||||||
<div className="flex flex-col-reverse lg:flex-col grow lg:grow-0 justify-between items-end">
|
<div className="flex flex-col-reverse lg:flex-col grow lg:grow-0 justify-between items-end">
|
||||||
<ul className="flex gap-0 lg:gap-[10px] items-center justify-end w-full flex-wrap">
|
<ul className="flex gap-0 lg:gap-[10px] items-center justify-end w-full flex-wrap">
|
||||||
{[
|
{[
|
||||||
{ text: "Open An Account", href: RouteHandler.getStarted },
|
{ text: "Open An Account", href: RouteHandler.letsGetStarted },
|
||||||
{
|
{
|
||||||
text: "Internet Banking",
|
text: "Internet Banking",
|
||||||
href: RouteHandler.businessBanking,
|
href: RouteHandler.businessBanking,
|
||||||
|
|||||||
+10
-1
@@ -1,4 +1,4 @@
|
|||||||
import { postAuxEnd } from "./axiosCall";
|
import { postAuxEnd, getAuxEnd } from "./axiosCall";
|
||||||
|
|
||||||
// FUNCTION TO START BVN VALIDATION
|
// FUNCTION TO START BVN VALIDATION
|
||||||
export const validateBVN = (postData:any) => {
|
export const validateBVN = (postData:any) => {
|
||||||
@@ -24,4 +24,13 @@ export const applyForLoan = (postData:any) => {
|
|||||||
...postData
|
...postData
|
||||||
}
|
}
|
||||||
return postAuxEnd('/loan/apply', reqData)
|
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)
|
||||||
}
|
}
|
||||||
@@ -56,3 +56,26 @@ export function postAuxEnd(uri: string, reqData: any): Promise<any> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getAuxEnd(uri: string, reqData: any): Promise<any> {
|
||||||
|
const endPoint = import.meta.env.VITE_USERS_ENDPOINT + uri;
|
||||||
|
const formData = new FormData();
|
||||||
|
for (let value in reqData) {
|
||||||
|
formData.append(value, reqData[value]);
|
||||||
|
}
|
||||||
|
return axios
|
||||||
|
.get(endPoint, reqData)
|
||||||
|
.then((response: {}) => {
|
||||||
|
// if (response.data.internal_return == "-9999") {
|
||||||
|
// localStorage.clear();
|
||||||
|
// window.location.href = `/login?sessionExpired=true`;
|
||||||
|
// }
|
||||||
|
return response;
|
||||||
|
})
|
||||||
|
.catch((error: any) => {
|
||||||
|
console.log(
|
||||||
|
"ERROR3-------------------------------------------------------", error
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -13,6 +13,6 @@ export interface User {
|
|||||||
last_login?:string
|
last_login?:string
|
||||||
message?:string
|
message?:string
|
||||||
token?:string
|
token?:string
|
||||||
uid?:string
|
customer_uid?:string
|
||||||
call_return?:string
|
call_return?:string
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import { Outlet, useNavigate } from "react-router-dom";
|
|||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { RouteHandler } from '../../router/routes';
|
import { RouteHandler } from '../../router/routes';
|
||||||
import { updateUserDetails } from '../../store/UserDetails';
|
import { updateUserDetails } from '../../store/UserDetails';
|
||||||
|
import { getUserByID } from '../../core/apiRequest';
|
||||||
|
|
||||||
import Logo from '../../assets/images/logo.png'
|
import Logo from '../../assets/images/logo.png'
|
||||||
|
|
||||||
@@ -19,19 +20,27 @@ export default function DashboardAuth() {
|
|||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
let token = localStorage.getItem('token')
|
let token = localStorage.getItem('token')
|
||||||
if(!token){
|
let uid = localStorage.getItem('uid')
|
||||||
|
if(!token || !uid){
|
||||||
navigate(RouteHandler.letsGetStarted, {replace:true})
|
navigate(RouteHandler.letsGetStarted, {replace:true})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const getUserByToken = () => {
|
const getUser = () => { // FUNCTION TO GET USER BY ID
|
||||||
let data = {firstname:'firstname', lastname:'lastname', uid:'28273737646466464'}
|
// let data = {firstname:'firstname', lastname:'lastname', uid:'28273737646466464'}
|
||||||
setTimeout(()=>{
|
getUserByID(uid).then(res=>{
|
||||||
|
if(!res.data.call_return || !Object.keys(res.data.customer).length){
|
||||||
|
navigate(RouteHandler.letsGetStarted, {replace:true})
|
||||||
|
return
|
||||||
|
}
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
dispatch(updateUserDetails({...data}));
|
dispatch(updateUserDetails(res.data.customer));
|
||||||
},4000)
|
}).catch(err=>{
|
||||||
|
navigate(RouteHandler.letsGetStarted, {replace:true})
|
||||||
|
console.log('USER ERROR', err)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
if(!Object.keys(userDetails).length){
|
if(!Object.keys(userDetails).length){
|
||||||
getUserByToken()
|
getUser()
|
||||||
}
|
}
|
||||||
},[])
|
},[])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user