added get user by ID API
This commit was merged in pull request #47.
This commit is contained in:
+10
-1
@@ -1,4 +1,4 @@
|
||||
import { postAuxEnd } from "./axiosCall";
|
||||
import { postAuxEnd, getAuxEnd } from "./axiosCall";
|
||||
|
||||
// FUNCTION TO START BVN VALIDATION
|
||||
export const validateBVN = (postData:any) => {
|
||||
@@ -24,4 +24,13 @@ export const applyForLoan = (postData:any) => {
|
||||
...postData
|
||||
}
|
||||
return postAuxEnd('/loan/apply', reqData)
|
||||
}
|
||||
|
||||
|
||||
// FUNCTION TO GET USER BY CUSTOMER UID
|
||||
export const getUserByID = () => {
|
||||
let reqData = {
|
||||
customer_uid: localStorage.getItem('uid'),
|
||||
}
|
||||
return getAuxEnd(`/profile?uid=${reqData.customer_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
|
||||
message?:string
|
||||
token?:string
|
||||
uid?:string
|
||||
customer_uid?:string
|
||||
call_return?:string
|
||||
}
|
||||
Reference in New Issue
Block a user