etender live and purchased list
This commit is contained in:
@@ -32,6 +32,7 @@ const PROCEED_PURCHASE_AUCTION = `${BASE_URL_Auction}api/auction/proceedToPurcha
|
||||
const PURCHASE_AUCTION = `${BASE_URL_Auction}api/auction/purchaseAuction`
|
||||
const PURCHASE_OFFLINE_AUCTION = `${BASE_URL_Auction}api/auction/purchaseAuctionOffline`
|
||||
const PURCHASE_TENDER = `https://procurelinc.in/EProcurementSB/tenderPayment/purchaseTender`
|
||||
const PURCHASE_TENDER_OFFLINE = `https://procurelinc.in/EProcurementSB/tenderPayment/purchaseTenderOffline`
|
||||
const AUCTION_PURCHASE_STATUS = `https://api.godemo.in/Auction/api/auction/transactionStatus?orderNo=`
|
||||
const GET_TENDER_DETAILS = `${BASE_URL}eTendering/getTenderById?tenderId=`
|
||||
const GET_DOCID = `${BASE_URL}eTendering/download/docId?docId=`
|
||||
@@ -62,6 +63,11 @@ const ITEM_DOCUMENT_DOWNLOAD = `${BASE_URL_Auction}api/auction/home/downloadDocu
|
||||
// Rohit
|
||||
const DASHBOARD_COUNT = `${BASE_URL_Auction}api/auction/home/dashboard/counts`
|
||||
|
||||
//tender
|
||||
|
||||
const TENDER_LOGIN = `${BASE_URL}eproc/loginWithoutDecryption`
|
||||
|
||||
|
||||
export {
|
||||
// Rohit
|
||||
DASHBOARD_COUNT,
|
||||
@@ -118,6 +124,8 @@ export {
|
||||
AUCTION_LOGIN,
|
||||
TWO_FACTOR_AUTH,
|
||||
GET_MASTER_DATA,
|
||||
PURCHASE_OFFLINE_AUCTION
|
||||
PURCHASE_OFFLINE_AUCTION,
|
||||
TENDER_LOGIN,
|
||||
PURCHASE_TENDER_OFFLINE,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { fetchDashboard, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseTender, offlineAuctionPurchase, userLogin } from './apis';
|
||||
import { fetchDashboard, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseTender, offlineAuctionPurchase, userLogin, offlineTenderPurchase, fetchTenderById } from './apis';
|
||||
|
||||
// User
|
||||
|
||||
@@ -19,23 +19,45 @@ export const useDashboard = () => {
|
||||
|
||||
// Auction & Tender
|
||||
|
||||
export const useFetchPurchaseTender = () => {
|
||||
export const useFetchPurchaseTender = (size: number) => {
|
||||
return useQuery({
|
||||
queryKey: [],
|
||||
queryFn: () => fetchPurchaseTender()
|
||||
queryKey: ['purchaseTender', size],
|
||||
queryFn: () => fetchPurchaseTender({ page: 0, size }),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const useFetchLiveTender = () => {
|
||||
return useQuery({
|
||||
queryKey: [],
|
||||
queryKey: ['fetchLiveTender',],
|
||||
queryFn: () => fetchLiveTender()
|
||||
});
|
||||
};
|
||||
export const useFetchPurchaseAuction = () => {
|
||||
return useQuery({
|
||||
queryKey: ['fetchPurchaseAuction',],
|
||||
queryFn: () => fetchPurchaseAuction()
|
||||
queryFn: ({ pageParam = 1 }) =>
|
||||
fetchPurchaseAuction({
|
||||
page: pageParam,
|
||||
size: 10,
|
||||
}),
|
||||
getNextPageParam: (lastPage: any) => {
|
||||
const { page, size, totalCount } = lastPage;
|
||||
const totalPages = Math.ceil(totalCount / size);
|
||||
const nextPage = page + 1;
|
||||
return nextPage < totalPages ? nextPage : undefined;
|
||||
},
|
||||
select: (data) => {
|
||||
|
||||
const mergedResults = data.pages.flatMap((page: any) => page.data ?? []);
|
||||
|
||||
console.log("mergedResults for tender : ", mergedResults)
|
||||
return {
|
||||
...data,
|
||||
result: mergedResults,
|
||||
};
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -74,4 +96,18 @@ export const useOfflineAuctionPurchase = () => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: any) => offlineAuctionPurchase(payload),
|
||||
});
|
||||
};
|
||||
};
|
||||
export const useOfflineTenderPurchase = () => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: any) => offlineTenderPurchase(payload),
|
||||
});
|
||||
};
|
||||
|
||||
export const useFetchTenderById = (tenderId: string) => {
|
||||
return useQuery({
|
||||
queryKey: ['fetchTenderById', tenderId],
|
||||
queryFn: () => fetchTenderById(tenderId)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
+58
-14
@@ -1,12 +1,13 @@
|
||||
import axios from "axios";
|
||||
import { DASHBOARD_COUNT, GET_MY_AUCTION, GET_MY_TENDER, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PROCEED_PURCHASE_AUCTION } from "./ApiUrls";
|
||||
import { DASHBOARD_COUNT, GET_MY_AUCTION, GET_MY_TENDER, GET_TENDER_DETAILS, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PROCEED_PURCHASE_AUCTION, PURCHASE_TENDER_OFFLINE, TENDER_LOGIN } from "./ApiUrls";
|
||||
import { apiCall } from "../../Axios/Axios";
|
||||
|
||||
// User
|
||||
|
||||
export const userLogin = async (payload: { emailAdd: string, password: string }): Promise<any> => {
|
||||
try {
|
||||
const response = await axios.post(LOG_IN_URL, { ...payload, divice: "mobileApp" });
|
||||
// const response = await axios.post(LOG_IN_URL, { ...payload, divice: "mobileApp" });
|
||||
const response = await axios.post(TENDER_LOGIN, { ...payload, device: "mobileApp" });
|
||||
return response.data;
|
||||
} catch (error: any) {
|
||||
throw error.response?.data || error.message;
|
||||
@@ -18,17 +19,8 @@ export const fetchDashboard = async (): Promise<any> => {
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
export const fetchPurchaseTender = async (): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${GET_MY_TENDER}`);
|
||||
return data
|
||||
}
|
||||
export const fetchLiveTender = async (): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${LIVE_TENDER}`);
|
||||
return data
|
||||
}
|
||||
export const fetchPurchaseAuction = async (): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${GET_MY_AUCTION}`);
|
||||
export const fetchPurchaseAuction = async (payload: any): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${GET_MY_AUCTION}`, {}, { payload });
|
||||
return data
|
||||
}
|
||||
export const fetchLiveAuction = async (payload: any): Promise<any> => {
|
||||
@@ -44,4 +36,56 @@ export const offlineAuctionPurchase = async (payload: any): Promise<any> => {
|
||||
} catch (error: any) {
|
||||
throw error.response?.data || error.message;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Tender Purchase offline
|
||||
export const offlineTenderPurchase = async (payload: any): Promise<any> => {
|
||||
try {
|
||||
const response = await apiCall<any>('post', PURCHASE_TENDER_OFFLINE, payload);
|
||||
return response.data;
|
||||
} catch (error: any) {
|
||||
throw error.response?.data || error.message;
|
||||
}
|
||||
};
|
||||
|
||||
// tender
|
||||
export const fetchPurchaseTender = async (payload: any): Promise<any> => {
|
||||
const data = await apiCall<any>(
|
||||
'get',
|
||||
`${GET_MY_TENDER}`, {},
|
||||
{ payload }
|
||||
);
|
||||
return data;
|
||||
};
|
||||
|
||||
|
||||
// export const fetchPurchaseTender = async (
|
||||
// page: number,
|
||||
// size: number
|
||||
// ): Promise<any> => {
|
||||
// const data = await apiCall<any>(
|
||||
// 'get',
|
||||
// `${GET_MY_TENDER}?page=0&size=${size}`
|
||||
// );
|
||||
|
||||
// console.log('Purchased Tenders Response:', data);
|
||||
// return data;
|
||||
// };
|
||||
|
||||
|
||||
export const fetchLiveTender = async (): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${LIVE_TENDER}`);
|
||||
return data
|
||||
}
|
||||
export const fetchTenderById = async (tenderId: string): Promise<any> => {
|
||||
console.log('Fetching tender with ID:', tenderId);
|
||||
|
||||
const data = await apiCall<any>(
|
||||
'get',
|
||||
`https://procurelinc.in/EProcurementSB/eTendering/getTenderById?tenderId=${tenderId}`
|
||||
);
|
||||
|
||||
console.log('API response:', data);
|
||||
return data;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user