Auciton process complete
This commit is contained in:
@@ -61,13 +61,25 @@ const ITEM_DOCUMENT_DOWNLOAD = `${BASE_URL_Auction}api/auction/home/downloadDocu
|
||||
|
||||
// Rohit
|
||||
const DASHBOARD_COUNT = `${BASE_URL_Auction}api/auction/home/dashboard/counts`
|
||||
const AUCTION_ONE_TIME_BID =`${BASE_URL_Auction}api/bidding/getBidForAuction`
|
||||
const AUCTION_ONE_TIME_BID = `${BASE_URL_Auction}api/bidding/getBidForAuction`
|
||||
const AUCITON_SINGLE_EMD = `${BASE_URL_Auction}api/auction/addEMDDocumentsAuctionWise`
|
||||
const PURCHASE_AUCTION_LIST = `${BASE_URL_Auction}api/auction/proceedToPurchase`
|
||||
const VIEW_AUCTION_ITEM_DETAIL = `${BASE_URL_Auction}api/auction/home/viewDocumentsForAuctionItemDetails`
|
||||
const VIEW_AUCTION_DOCUMENTS = `${BASE_URL_Auction}api/auction/viewDocumentsForAuction`
|
||||
const AUCTION_DOCUMENT_DOWNLOAD = `${BASE_URL_Auction}api/auction/home/downloadDocumentForAuction`
|
||||
const AUCTION_ITEM_DOCUMENT_DOWNLOAD = `${BASE_URL_Auction}api/auction/home/downloadDocument/auctionItemId`
|
||||
|
||||
export {
|
||||
// Rohit
|
||||
VIEW_AUCTION_ITEM_DETAIL,
|
||||
AUCTION_ITEM_DOCUMENT_DOWNLOAD,
|
||||
AUCTION_DOCUMENT_DOWNLOAD,
|
||||
VIEW_AUCTION_DOCUMENTS,
|
||||
AUCITON_SINGLE_EMD,
|
||||
DASHBOARD_COUNT,
|
||||
AUCTION_ONE_TIME_BID,
|
||||
ITEM_DOCUMENT_DOWNLOAD,
|
||||
PURCHASE_AUCTION_LIST,
|
||||
ITEM_DETAIL,
|
||||
TECHNICAL_DOCUMENT_SUBMIT,
|
||||
TECHNICAL_VALUE_SUBMIT,
|
||||
|
||||
+51
-13
@@ -1,5 +1,5 @@
|
||||
import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { fetchAuctionItem, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseTender, offlineAuctionPurchase, userLogin } from './apis';
|
||||
import { fetchAuctionItem, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseAuctionList, fetchPurchaseTender, getAuction, offlineAuctionPurchase, userLogin, viewAuctionDocumentDownload, viewAuctionDocuments, viewAuctionItemDocuments } from './apis';
|
||||
|
||||
// User
|
||||
|
||||
@@ -32,6 +32,7 @@ export const useFetchLiveTender = () => {
|
||||
queryFn: () => fetchLiveTender()
|
||||
});
|
||||
};
|
||||
|
||||
export const useFetchPurchaseAuction = () => {
|
||||
return useQuery({
|
||||
queryKey: ['fetchPurchaseAuction',],
|
||||
@@ -39,25 +40,28 @@ export const useFetchPurchaseAuction = () => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
export const useFetchLiveAuction = () => {
|
||||
return useInfiniteQuery<any>({
|
||||
queryKey: ['fetchLiveAuction',],
|
||||
queryFn: ({ pageParam = 1 }) =>
|
||||
queryKey: ['fetchLiveAuction'],
|
||||
queryFn: ({ pageParam = 0 }) =>
|
||||
fetchLiveAuction({
|
||||
page: pageParam,
|
||||
size: 10,
|
||||
}),
|
||||
initialPageParam: 1,
|
||||
getNextPageParam: (lastPage) => {
|
||||
const { page, size, totalCount } = lastPage;
|
||||
initialPageParam: 0,
|
||||
|
||||
getNextPageParam: (lastPage, allPages) => {
|
||||
const { size, totalCount } = lastPage;
|
||||
const totalPages = Math.ceil(totalCount / size);
|
||||
const nextPage = page + 1;
|
||||
const nextPage = allPages.length;
|
||||
return nextPage < totalPages ? nextPage : undefined;
|
||||
},
|
||||
select: (data) => {
|
||||
|
||||
const mergedResults = data.pages.flatMap((page: any) => page.data ?? []);
|
||||
select: (data) => {
|
||||
const mergedResults = data.pages.flatMap(
|
||||
(page: any) => page?.data ?? []
|
||||
);
|
||||
|
||||
return {
|
||||
...data,
|
||||
result: mergedResults,
|
||||
@@ -67,7 +71,6 @@ export const useFetchLiveAuction = () => {
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Auction Purchase offline
|
||||
|
||||
export const useOfflineAuctionPurchase = () => {
|
||||
@@ -85,6 +88,41 @@ export const useEmdCheck = () => {
|
||||
|
||||
export const useAuctionItem = () => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: any) => fetchAuctionItem(payload),
|
||||
mutationFn: (payload: { auctionNumber: string, status: string }) => fetchAuctionItem(payload),
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Purchase Auction List
|
||||
export const usePurchaseAuctionList = () => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: any) => fetchPurchaseAuctionList(payload),
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetAuciton = (payload: { auctionId: string }) => {
|
||||
return useQuery({
|
||||
queryKey: ['getAuction'],
|
||||
queryFn: () => getAuction(payload)
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetAucitonDocument = (payload: { auctionId: number }) => {
|
||||
return useQuery({
|
||||
queryKey: ['viewAuctionDocuments'],
|
||||
queryFn: () => viewAuctionDocuments(payload)
|
||||
});
|
||||
};
|
||||
|
||||
export const useAucitonItemDetail = (payload: { auctionItemId: number }) => {
|
||||
return useQuery({
|
||||
queryKey: ['viewAuctionItemDocuments'],
|
||||
queryFn: () => viewAuctionItemDocuments(payload)
|
||||
});
|
||||
};
|
||||
|
||||
export const useAucitonDocDownload = () => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: { documentId: number, isAmendment: boolean }) => viewAuctionDocumentDownload(payload),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import axios from "axios";
|
||||
import { DASHBOARD_COUNT, EMD_CHECK, FORARD_AUCTION_ITEM, GET_MY_AUCTION, GET_MY_TENDER, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PROCEED_PURCHASE_AUCTION, PURCHASE_OFFLINE_AUCTION, REVERSE_AUCTION_ITEM } from "./ApiUrls";
|
||||
import { AUCTION_DOCUMENT_DOWNLOAD, DASHBOARD_COUNT, EMD_CHECK, FORARD_AUCTION_ITEM, GET_AUCTION_DETAILS, GET_MY_AUCTION, GET_MY_TENDER, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PROCEED_PURCHASE_AUCTION, PURCHASE_AUCTION_LIST, PURCHASE_OFFLINE_AUCTION, REVERSE_AUCTION_ITEM, VIEW_AUCTION_DOCUMENTS, VIEW_AUCTION_ITEM_DETAIL } from "./ApiUrls";
|
||||
import { apiCall } from "../../Axios/Axios";
|
||||
|
||||
// User
|
||||
@@ -32,7 +32,7 @@ export const fetchPurchaseAuction = async (): Promise<any> => {
|
||||
return data
|
||||
}
|
||||
export const fetchLiveAuction = async (payload: any): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${LIVE_AUCTION}`, {}, { payload });
|
||||
const data = await apiCall<any>('get', `${LIVE_AUCTION}`, {}, payload);
|
||||
return data
|
||||
}
|
||||
|
||||
@@ -71,4 +71,27 @@ export const fetchAuctionItem = async (payload: any): Promise<any> => {
|
||||
} catch (error: any) {
|
||||
throw error.response?.data || error.message;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
export const fetchPurchaseAuctionList = async (payload: any): Promise<any> => {
|
||||
const data = await apiCall<any>('post', `${PURCHASE_AUCTION_LIST}`, payload);
|
||||
return data
|
||||
}
|
||||
|
||||
export const getAuction = async (payload: any) => {
|
||||
const selectedRes = await apiCall<any>('get', GET_AUCTION_DETAILS, {}, { id: payload.auctionId });
|
||||
return selectedRes.data;
|
||||
}
|
||||
export const viewAuctionItemDocuments = async (payload: { auctionItemId: number }) => {
|
||||
const selectedRes = await apiCall<any>('get', VIEW_AUCTION_ITEM_DETAIL, {}, payload);
|
||||
return selectedRes.data;
|
||||
}
|
||||
export const viewAuctionDocuments = async (payload: { auctionId: number }) => {
|
||||
const selectedRes = await apiCall<any>('get', VIEW_AUCTION_DOCUMENTS, {}, payload);
|
||||
return selectedRes.data;
|
||||
}
|
||||
export const viewAuctionDocumentDownload = async (payload: { documentId: number, isAmendment: boolean }) => {
|
||||
const selectedRes = await apiCall<any>('get', AUCTION_DOCUMENT_DOWNLOAD, {}, payload);
|
||||
return selectedRes.data;
|
||||
}
|
||||
Reference in New Issue
Block a user