added loan details API

This commit is contained in:
victorAnumudu
2024-07-15 17:09:06 +01:00
parent ee1fe4a5b6
commit 0fc549f1b5
4 changed files with 170 additions and 45 deletions
+49
View File
@@ -33,8 +33,57 @@ export type User = {
employer_name?: string
}
export type VerifiedLoanDetails = {
application_uid?: string
application?: Array<{[index: string]: string}>
// application?: [
// {
// "id": "21",
// "uid": "006915e9-cb0d-42e9-b4af-c047da51e2ac",
// "customer_uid": "9cb678e0-0697-4cc9-9bf0-3f40a3c989fb",
// "loan_amount": "2220",
// "payment_month": "18",
// "sales_agent": "866969",
// "gender": null,
// "marital_status": "single",
// "email": "ameye+update@chiefsoft.com",
// "address": "4201 Defoors Farm Trail",
// "state": "abia",
// "country": "NG",
// "loan_detail": "{\"customer_uid\":\"9cb678e0-0697-4cc9-9bf0-3f40a3c989fb\",\"loan_amount\":\"2220\",\"payment_month\":\"18\",\"sales_agent\":\"866969\",\"gender\":\"female\",\"address\":\"4201 Defoors Farm Trail\",\"marital_status\":\"single\",\"state\":\"abia\",\"email\":\"ameye+update@chiefsoft.com\",\"country\":\"NG\",\"employer_uid\":\"3a9ec95a-090c-4c98-bc01-e96d76b93952\",\"employment\":\"[object Object]\",\"loan_reference\":\"[object Object],[object Object]\",\"disbursement\":\"[object Object]\"}",
// "status": "4",
// "added": "2024-07-10 21:28:13.404726",
// "updated": "2024-07-10 21:28:13.404726",
// "employer_uid": "3a9ec95a-090c-4c98-bc01-e96d76b93952"
// }
// ],
verification?: Array<{[index: string]: string}>
// "verification": [
// {
// "id": "56",
// "uid": "e041279c-875d-4973-b042-48efec05fecf",
// "employer_uid": "3a9ec95a-090c-4c98-bc01-e96d76b93952",
// "status": "1",
// "added": "2024-07-11 16:03:25.343553",
// "updated": "2024-07-11 16:03:25.343553",
// "username": "ameye+update@chiefsoft.com",
// "password": "5769407ab4409037161a51692c6bb617",
// "signatory_uid": "db444b87-ec0f-483b-a8cf-eea9e8466f10",
// "application_uid": "006915e9-cb0d-42e9-b4af-c047da51e2ac",
// "education": "b.sc",
// "grade": "Test 001",
// "applicant_date": "2024-07-10 00:00:00",
// "ippis_number": "",
// "employers_name": "bshshsjss",
// "designation": "jdjdjddk"
// }
// ]
}
export type UsersQueryResponse = Response<Array<User>>
export type VerifiedLoanDetailsResponse = Response<VerifiedLoanDetails>
export const initialUser: User = {
avatar: 'avatars/300-6.jpg',
position: 'Art Director',
+8 -2
View File
@@ -1,7 +1,7 @@
import axios, { AxiosResponse } from "axios";
import { ID, Response } from "../../../../_digifi/helpers"
import { User, UsersQueryResponse } from "./_models";
import { postAuxEnd } from "../../auth/core/AxiosCallHelper";
import { User, UsersQueryResponse, VerifiedLoanDetailsResponse } from "./_models";
import { postAuxEnd, getAuxEnd } from "../../auth/core/AxiosCallHelper";
const API_URL = import.meta.env.VITE_APP_THEME_API_URL;
const USER_URL = `${API_URL}/user`;
@@ -54,6 +54,10 @@ const employersVerify = (uid: ID): Promise<UsersQueryResponse> => { // FUNCTION
return postAuxEnd('/employers/verify', {application_uid:uid})
};
const getVerifiedLoanDetailsByUID = (uid: string): Promise<VerifiedLoanDetailsResponse> => { // FUNCTION TO GET VERIFIED LOAN DETAILS IN ORDER TO PROCESS
return getAuxEnd(`/loan/process/${uid}`)
};
const getUserById = (id: ID): Promise<User | undefined> => {
return axios
.get(`${USER_URL}/${id}`)
@@ -92,6 +96,8 @@ export {
getVerifiedUsers,
getApprovedUsers,
employersVerify,
getVerifiedLoanDetailsByUID,
deleteUser,
deleteSelectedUsers,
getUserById,