initial commit

This commit is contained in:
victorAnumudu
2024-05-08 18:54:58 +01:00
parent 395fe1a648
commit 2526a5b627
4 changed files with 168 additions and 196 deletions
@@ -45,6 +45,29 @@ export function postAuxEnd(uri:string, reqData:any):Promise<any> {
);
}
});
}
export function getAuxEnd(uri: string, reqData?: any): Promise<any> {
const endPoint = import.meta.env.VITE_APP_USER_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
);
});
}
+6 -1
View File
@@ -1,7 +1,7 @@
import axios from "axios";
import { AuthModel, UserModel } from "./_models";
import { postAuxEnd } from "./AxiosCallHelper";
import { postAuxEnd, getAuxEnd } from "./AxiosCallHelper";
const API_URL = import.meta.env.VITE_APP_API_URL;
@@ -10,6 +10,7 @@ const API_URL = import.meta.env.VITE_APP_API_URL;
export const GET_USER_BY_ACCESSTOKEN_URL = '/identity/verify_token'
export const LOGIN_URL = '/identity/token'
export const USER_DASH_DETAILS = `/dash`;
export const REGISTER_URL = `${API_URL}/register`;
export const REQUEST_PASSWORD_URL = `${API_URL}/forgot_password`;
@@ -55,3 +56,7 @@ export function requestPassword(email: string) {
export function getUserByToken(token: string) {
return postAuxEnd(GET_USER_BY_ACCESSTOKEN_URL, {token})
}
export function getUserDashDetails() {
return getAuxEnd(USER_DASH_DETAILS)
}
+83 -67
View File
@@ -1,15 +1,15 @@
import { FC } from 'react';
import { FC, useEffect, useState } from 'react';
import { useIntl } from 'react-intl';
import { toAbsoluteUrl } from '../../../_digifi/helpers';
import { PageTitle } from '../../../_digifi/layout/core';
import {
ListsWidget2,
// ListsWidget2,
ListsWidget3,
ListsWidget4,
ListsWidget6,
TablesWidget5,
// ListsWidget4,
// ListsWidget6,
// TablesWidget5,
TablesWidget10,
MixedWidget8,
// MixedWidget8,
CardsWidget7,
CardsWidget17,
CardsWidget20,
@@ -18,76 +18,92 @@ import {
} from '../../../_digifi/partials/widgets';
import { ToolbarWrapper } from '../../../_digifi/layout/components/toolbar';
import { Content } from '../../../_digifi/layout/components/content';
import { getUserDashDetails } from '../../modules/auth/core/_requests';
const DashboardPage: FC = () => (
<>
<ToolbarWrapper />
<Content>
{/* begin::Row */}
<div className="row g-5 g-xl-10 mb-5 mb-xl-10">
{/* begin::Col */}
<div className="col-md-6 col-lg-6 col-xl-6 col-xxl-3 mb-md-5 mb-xl-10">
<CardsWidget20
className="h-md-50 mb-5 mb-xl-10"
description="Active Projects"
color="#F1416C"
img={toAbsoluteUrl('media/patterns/vector-1.png')}
/>
<CardsWidget7
className="h-md-50 mb-5 mb-xl-10"
description="Professionals"
icon={false}
stats={357}
labelColor="dark"
textColor="gray-300"
/>
</div>
{/* end::Col */}
const DashboardPage: FC = () => {
const [dashDetails, setDashDetails] = useState({loading:true, data:{}})
{/* begin::Col */}
<div className="col-md-6 col-lg-6 col-xl-6 col-xxl-3 mb-md-5 mb-xl-10">
<CardsWidget17 className="h-md-50 mb-5 mb-xl-10" />
<ListsWidget26 className="h-lg-50" />
</div>
{/* end::Col */}
useEffect(()=>{
getUserDashDetails().then(res => {
setDashDetails({loading:false, data:res.data})
}).catch(err => {
setDashDetails({loading:false, data:{}})
console.log(err)
})
},[])
{/* begin::Col */}
<div className="col-xxl-6">
<EngageWidget10 className="h-md-100" />
</div>
{/* end::Col */}
</div>
{/* end::Row */}
return (
<>
<ToolbarWrapper />
<Content>
{/* begin::Row */}
<div className="row g-5 g-xl-10 mb-5 mb-xl-10">
{/* begin::Col */}
<div className="col-md-6 col-lg-6 col-xl-6 col-xxl-3 mb-md-5 mb-xl-10">
<CardsWidget20
className="h-md-50 mb-5 mb-xl-10"
description="Active Projects"
color="#F1416C"
img={toAbsoluteUrl('media/patterns/vector-1.png')}
/>
<CardsWidget7
className="h-md-50 mb-5 mb-xl-10"
description="Professionals"
icon={false}
stats={357}
labelColor="dark"
textColor="gray-300"
/>
</div>
{/* end::Col */}
{/* begin::Row */}
<div className="row gx-5 gx-xl-10">
{/* begin::Col */}
<div className="col-xxl-6 mb-5 mb-xl-10">
{/* <app-new-charts-widget8 cssclassName="h-xl-100" chartHeight="275px" [chartHeightNumber]="275"></app-new-charts-widget8> */}
</div>
{/* end::Col */}
{/* begin::Col */}
<div className="col-md-6 col-lg-6 col-xl-6 col-xxl-3 mb-md-5 mb-xl-10">
<CardsWidget17 className="h-md-50 mb-5 mb-xl-10" />
<ListsWidget26 className="h-lg-50" />
</div>
{/* end::Col */}
{/* begin::Col */}
<div className="col-xxl-6 mb-5 mb-xl-10">
{/* <app-cards-widget18 cssclassName="h-xl-100" image="./assetsmedia/stock/600x600/img-65.jpg"></app-cards-widget18> */}
{/* begin::Col */}
<div className="col-xxl-6">
<EngageWidget10 className="h-md-100" />
</div>
{/* end::Col */}
</div>
{/* end::Col */}
</div>
{/* end::Row */}
{/* end::Row */}
{/* begin::Row */}
<div className="row gy-5 gx-xl-8">
<div className="col-xxl-4">
<ListsWidget3 className="card-xxl-stretch mb-xl-3" />
{/* begin::Row */}
<div className="row gx-5 gx-xl-10">
{/* begin::Col */}
<div className="col-xxl-6 mb-5 mb-xl-10">
{/* <app-new-charts-widget8 cssclassName="h-xl-100" chartHeight="275px" [chartHeightNumber]="275"></app-new-charts-widget8> */}
</div>
{/* end::Col */}
{/* begin::Col */}
<div className="col-xxl-6 mb-5 mb-xl-10">
{/* <app-cards-widget18 cssclassName="h-xl-100" image="./assetsmedia/stock/600x600/img-65.jpg"></app-cards-widget18> */}
</div>
{/* end::Col */}
</div>
<div className="col-xl-8">
<TablesWidget10 className="card-xxl-stretch mb-5 mb-xl-8" />
{/* end::Row */}
{/* begin::Row */}
<div className="row gy-5 gx-xl-8">
{/* BVN VERIFICATION */}
<div className="col-xxl-4">
<ListsWidget3 dashData={dashDetails} className="card-xxl-stretch mb-xl-3" />
</div>
{/* RECENT LOAN APPLICATION */}
<div className="col-xl-8">
<TablesWidget10 className="card-xxl-stretch mb-5 mb-xl-8" />
</div>
</div>
</div>
{/* end::Row */}
</Content>
</>
);
{/* end::Row */}
</Content>
</>
)
}
const DashboardWrapper: FC = () => {
const intl = useIntl();