diff --git a/src/core/apiRequest.ts b/src/core/apiRequest.ts index a9d7071..916615f 100644 --- a/src/core/apiRequest.ts +++ b/src/core/apiRequest.ts @@ -28,9 +28,9 @@ export const applyForLoan = (postData:any) => { // FUNCTION TO GET USER BY CUSTOMER UID -export const getUserByID = () => { +export const getUserByID = (uid:string) => { let reqData = { - customer_uid: localStorage.getItem('uid'), + // customer_uid: localStorage.getItem('uid'), } - return getAuxEnd(`/profile?uid=${reqData.customer_uid}`, reqData) + return getAuxEnd(`/profile?uid=${uid}`, reqData) } \ No newline at end of file diff --git a/src/layouts/DashboardLayout/DashboardAuth.tsx b/src/layouts/DashboardLayout/DashboardAuth.tsx index 1923bd0..8400f96 100644 --- a/src/layouts/DashboardLayout/DashboardAuth.tsx +++ b/src/layouts/DashboardLayout/DashboardAuth.tsx @@ -20,13 +20,14 @@ export default function DashboardAuth() { useEffect(()=>{ let token = localStorage.getItem('token') - if(!token){ + let uid = localStorage.getItem('uid') + if(!token || !uid){ navigate(RouteHandler.letsGetStarted, {replace:true}) return } const getUser = () => { // FUNCTION TO GET USER BY ID // let data = {firstname:'firstname', lastname:'lastname', uid:'28273737646466464'} - getUserByID().then(res=>{ + getUserByID(uid).then(res=>{ if(!res.data.call_return || !Object.keys(res.data.customer).length){ navigate(RouteHandler.letsGetStarted, {replace:true}) return @@ -34,6 +35,7 @@ export default function DashboardAuth() { setLoading(false) dispatch(updateUserDetails(res.data.customer)); }).catch(err=>{ + navigate(RouteHandler.letsGetStarted, {replace:true}) console.log('USER ERROR', err) }) }