merge signup process
This commit is contained in:
@@ -71,6 +71,7 @@ const VIEW_AUCTION_DOCUMENTS = `${BASE_URL_Auction}api/auction/viewDocumentsForA
|
||||
const AUCTION_DOCUMENT_DOWNLOAD = `${BASE_URL_Auction}api/auction/home/downloadDocumentForAuction`
|
||||
const AUCTION_ITEM_DOCUMENT_DOWNLOAD = `${BASE_URL_Auction}api/auction/home/downloadDocument/auctionItemId`
|
||||
|
||||
|
||||
//tender
|
||||
|
||||
const TENDER_LOGIN = `${BASE_URL}eproc/loginWithoutDecryption`
|
||||
|
||||
+134
-33
@@ -1,13 +1,21 @@
|
||||
import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { fetchAuctionItem, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseAuctionList, fetchPurchaseTender, getAuction, offlineAuctionPurchase, userLogin, offlineTenderPurchase, fetchTenderById, proceedToBid, viewAuctionDocumentDownload, viewAuctionDocuments, viewAuctionItemDocuments, fetchPurchaseAuctionPage } from './apis';
|
||||
import { contractorStageThreeSubmit, contractorStageTwoSubmit, fetchAuctionItem, fetchCityDropdown, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchMasterData, fetchPurchaseAuction, fetchPurchaseAuctionList, fetchPurchaseTender, fetchTenderById, getAuction, getDesignation, getRagistrationState, offlineAuctionPurchase, offlineTenderPurchase, partnerShipSubmit, proceedToBid, registerContractor, sendAadhaarOtp, submitEnvelopeA, submitEnvelopeB, uploadEnvelopeFile, userAuctionLogin, userLogin, verifyAadhaarOtp, verifyGstNumber, verifyPanHandler, viewAuctionDocumentDownload, viewAuctionDocuments, viewAuctionItemDocuments, fetchPurchaseAuctionPage } from './apis';
|
||||
import { apiCall } from '../../Axios/Axios';
|
||||
|
||||
// User
|
||||
|
||||
export const useLogin = () => {
|
||||
console.log("hitting here")
|
||||
return useMutation({
|
||||
mutationFn: (payload: { emailAdd: string, password: string }) => userLogin(payload),
|
||||
});
|
||||
};
|
||||
export const useAuctionLogin = () => {
|
||||
console.log("hitting here")
|
||||
return useMutation({
|
||||
mutationFn: (payload: { emailAdd: string, password: string }) => userAuctionLogin(payload),
|
||||
});
|
||||
};
|
||||
|
||||
// Dashboard
|
||||
export const useDashboard = () => {
|
||||
@@ -20,31 +28,30 @@ export const useDashboard = () => {
|
||||
// Auction & Tender
|
||||
|
||||
export const useFetchPurchaseTender = () => {
|
||||
return useInfiniteQuery({
|
||||
queryKey: ['fetchPurchaseTender'],
|
||||
queryFn: ({ pageParam = 0 }) =>
|
||||
fetchPurchaseTender({
|
||||
page: pageParam,
|
||||
size: 10,
|
||||
}),
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: (lastPage, allPages) => {
|
||||
console.log('last page : ', lastPage)
|
||||
console.log("all page : ", allPages)
|
||||
const {totalCount } = lastPage;
|
||||
return useInfiniteQuery({
|
||||
queryKey: ['fetchPurchaseTender'],
|
||||
initialPageParam: 1,
|
||||
queryFn: ({ pageParam }) =>
|
||||
fetchPurchaseTender({
|
||||
page: pageParam,
|
||||
size: 10,
|
||||
}),
|
||||
|
||||
const totalPages = Math.ceil(totalCount / 10);
|
||||
const nextPage = allPages.length;
|
||||
return nextPage < totalPages ? nextPage : undefined;
|
||||
},
|
||||
getNextPageParam: (lastPage) => {
|
||||
const { page, size, totalCount } = lastPage;
|
||||
|
||||
select: (data) => ({
|
||||
...data,
|
||||
result: data.pages.flatMap(
|
||||
(page: any) => page?.data ?? []
|
||||
),
|
||||
}),
|
||||
});
|
||||
const totalPages = Math.ceil(totalCount / size);
|
||||
|
||||
return page < totalPages ? page + 1 : undefined;
|
||||
},
|
||||
|
||||
select: (data) => ({
|
||||
...data,
|
||||
result: data.pages.flatMap(
|
||||
(page: any) => page?.data ?? []
|
||||
),
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -141,19 +148,23 @@ export const useFetchTenderById = (tenderId: string) => {
|
||||
return useQuery({
|
||||
queryKey: ['fetchTenderById', tenderId],
|
||||
queryFn: () => fetchTenderById(tenderId)
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
export const useProceedToBid = (tenderId?: string) => {
|
||||
return useQuery({
|
||||
queryKey: ['proceedToBid', tenderId],
|
||||
queryFn: () => proceedToBid(tenderId as string),
|
||||
enabled: false, // 👈 manual trigger
|
||||
});
|
||||
return useQuery({
|
||||
queryKey: ['proceedToBid', tenderId],
|
||||
queryFn: () => proceedToBid(tenderId as string),
|
||||
enabled: false, // 👈 manual trigger
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
export const useAuctionItem = () => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: any) => fetchAuctionItem(payload),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// EMD
|
||||
@@ -163,12 +174,99 @@ export const useEmdCheck = () => {
|
||||
});
|
||||
};
|
||||
|
||||
export const useAuctionItem = () => {
|
||||
export const useGetDesignation = () => {
|
||||
return useQuery({
|
||||
queryKey: ['Designation'],
|
||||
queryFn: () => getDesignation()
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
export const useRegisterContractor = () => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: { auctionNumber: string, status: string }) => fetchAuctionItem(payload),
|
||||
mutationFn: (payload: any) => registerContractor(payload),
|
||||
});
|
||||
};
|
||||
|
||||
export const useRagistrationState = () => {
|
||||
return useMutation({
|
||||
mutationFn: () => getRagistrationState(),
|
||||
});
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
export const usefetchMasterData = () => {
|
||||
return useQuery({
|
||||
queryKey: ['MasterData'],
|
||||
queryFn: () => fetchMasterData()
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
export const useCityDropdown = () => {
|
||||
return useMutation({
|
||||
mutationFn: (stateId: number) => fetchCityDropdown(stateId),
|
||||
});
|
||||
};
|
||||
|
||||
export const useVerifyPan = () =>
|
||||
useMutation({
|
||||
mutationFn: verifyPanHandler,
|
||||
});
|
||||
|
||||
|
||||
export const useSendAadhaarOtp = () =>
|
||||
useMutation({
|
||||
mutationFn: sendAadhaarOtp,
|
||||
});
|
||||
|
||||
export const useVerifyAadhaarOtp = () =>
|
||||
useMutation({
|
||||
mutationFn: verifyAadhaarOtp,
|
||||
});
|
||||
|
||||
export const useVerifyGstNumber = () =>
|
||||
useMutation({
|
||||
mutationFn: verifyGstNumber,
|
||||
});
|
||||
|
||||
|
||||
export const useContractorStageTwoSubmit = () =>
|
||||
useMutation({
|
||||
mutationFn: contractorStageTwoSubmit,
|
||||
});
|
||||
|
||||
export const useContractorStageThreeSubmit = () =>
|
||||
useMutation({
|
||||
mutationFn: contractorStageThreeSubmit,
|
||||
});
|
||||
|
||||
export const usePartnerShipSubmit = () =>
|
||||
useMutation({
|
||||
mutationFn: partnerShipSubmit,
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const useSubmitEnvelopeA = () =>
|
||||
useMutation({
|
||||
mutationFn: submitEnvelopeA,
|
||||
})
|
||||
|
||||
export const useSubmitEnvelopeB = () =>
|
||||
useMutation({
|
||||
mutationFn: submitEnvelopeB,
|
||||
})
|
||||
|
||||
export const useUploadEnvelopeFile = () =>
|
||||
useMutation({
|
||||
mutationFn: uploadEnvelopeFile,
|
||||
})
|
||||
|
||||
|
||||
|
||||
// Purchase Auction List
|
||||
export const usePurchaseAuctionList = () => {
|
||||
@@ -203,3 +301,6 @@ export const useAucitonDocDownload = () => {
|
||||
mutationFn: (payload: { documentId: number, isAmendment: boolean }) => viewAuctionDocumentDownload(payload),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
+204
-1
@@ -1,8 +1,26 @@
|
||||
import axios from "axios";
|
||||
import { AUCTION_DOCUMENT_DOWNLOAD, DASHBOARD_COUNT, EMD_CHECK, FORARD_AUCTION_ITEM, GET_AUCTION_DETAILS, GET_MY_AUCTION, GET_MY_TENDER, GET_TENDER_DETAILS, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PROCEED_PURCHASE_AUCTION, PROCEED_TO_BID, PURCHASE_TENDER_OFFLINE, TENDER_LOGIN, PURCHASE_AUCTION_LIST, PURCHASE_OFFLINE_AUCTION, REVERSE_AUCTION_ITEM, VIEW_AUCTION_DOCUMENTS, VIEW_AUCTION_ITEM_DETAIL, PURCHASE_AUCTION_PAGE } from "./ApiUrls";
|
||||
import { AUCTION_DOCUMENT_DOWNLOAD, DASHBOARD_COUNT, EMD_CHECK, FORARD_AUCTION_ITEM, GET_AUCTION_DETAILS, GET_MY_AUCTION, GET_MY_TENDER, GET_TENDER_DETAILS, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PROCEED_PURCHASE_AUCTION, PROCEED_TO_BID, PURCHASE_TENDER_OFFLINE, TENDER_LOGIN, PURCHASE_AUCTION_LIST, PURCHASE_OFFLINE_AUCTION, REVERSE_AUCTION_ITEM, VIEW_AUCTION_DOCUMENTS, VIEW_AUCTION_ITEM_DETAIL, STAGETHREE, REJ_STAGE_TWO, GETCONTRACTORBYSTATE, GET_MASTER_DATA, ALL_DESIGNATION, GET_REGISTRATION_STATE, PARTNER_API_ENDPOINT, SAVE_CONTRACTOR_STAGE1, VERIFY_GST, VERIFY_ADHAR, SEND_ADHAROTP, SUBMIT_ENVELOPE_FILE_B, SUBMIT_ENVELOPE_FILE_A, SUBMIT_ENVELOPE_A, SUBMIT_ENVELOPE_B, VERIFY_ORGPAN, PURCHASE_AUCTION_PAGE } from "./ApiUrls";
|
||||
import { apiCall } from "../../Axios/Axios";
|
||||
|
||||
// User
|
||||
export type UploadArgs = {
|
||||
activeEnvelope: 'A' | 'B'
|
||||
file: {
|
||||
uri: string
|
||||
name: string
|
||||
type: string
|
||||
}
|
||||
payload: any
|
||||
}
|
||||
type DropdownOption = { label: string; value: number | string };
|
||||
|
||||
type State = { stateId: number; stateName: string };
|
||||
type ContractorClass = { contClassId: number; contClassName?: string };
|
||||
type Org = { orgId: number; organizationType: string };
|
||||
type MSME = { msmeId: number; comName: string };
|
||||
type Social = { socialCategoryId: number; categoryName: string };
|
||||
type Designation = { designationid: number; designationName: string };
|
||||
type City = { id: number; name: string };
|
||||
|
||||
export const userLogin = async (payload: { emailAdd: string, password: string }): Promise<any> => {
|
||||
try {
|
||||
@@ -14,6 +32,15 @@ export const userLogin = async (payload: { emailAdd: string, password: string })
|
||||
}
|
||||
};
|
||||
|
||||
export const userAuctionLogin = async (payload: { emailAdd: string, password: string }): Promise<any> => {
|
||||
try {
|
||||
const response = await axios.post(LOG_IN_URL, { ...payload, device: "mobileApp" });
|
||||
return response.data;
|
||||
} catch (error: any) {
|
||||
throw error.response?.data || error.message;
|
||||
}
|
||||
};
|
||||
|
||||
export const fetchDashboard = async (): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${DASHBOARD_COUNT}`);
|
||||
return data
|
||||
@@ -116,6 +143,19 @@ export const proceedToBid = async (tenderId: string): Promise<any> => {
|
||||
return data;
|
||||
}
|
||||
|
||||
export const verifyPanHandler = (
|
||||
payload: {
|
||||
dob: string;
|
||||
name: string;
|
||||
panNumber: string;
|
||||
}
|
||||
): Promise<any> => {
|
||||
return apiCall<any>(
|
||||
'post',
|
||||
VERIFY_ORGPAN,
|
||||
payload,
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
export const fetchPurchaseAuctionList = async (payload: any): Promise<any> => {
|
||||
@@ -138,4 +178,167 @@ export const viewAuctionDocuments = async (payload: { auctionId: number }) => {
|
||||
export const viewAuctionDocumentDownload = async (payload: { documentId: number, isAmendment: boolean }) => {
|
||||
const selectedRes = await apiCall<any>('get', AUCTION_DOCUMENT_DOWNLOAD, {}, payload);
|
||||
return selectedRes.data;
|
||||
}
|
||||
export const contractorStageThreeSubmit = (
|
||||
payload: any
|
||||
): Promise<any> => {
|
||||
return apiCall<any>(
|
||||
'post',
|
||||
STAGETHREE,
|
||||
payload,
|
||||
);
|
||||
};
|
||||
|
||||
export const contractorStageTwoSubmit = (
|
||||
fileData: any
|
||||
): Promise<any> => {
|
||||
return apiCall<any>(
|
||||
'post',
|
||||
REJ_STAGE_TWO,
|
||||
fileData,
|
||||
undefined,
|
||||
'multipart/form-data'
|
||||
);
|
||||
};
|
||||
|
||||
export const fetchCityDropdown = async (stateId: number): Promise<any> => {
|
||||
const res = await apiCall<{ statusCode: number; data: City[] }>(
|
||||
'get',
|
||||
`${GETCONTRACTORBYSTATE}?stateId=${stateId}`,
|
||||
);
|
||||
console.log("--",res)
|
||||
if (res.statusCode !== 200 || !res.data) {
|
||||
throw new Error('Failed load cities');
|
||||
}
|
||||
|
||||
return res.data.map(item => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
export const fetchMasterData = async (): Promise<any> => {
|
||||
const data = await apiCall<any>(
|
||||
'get',
|
||||
`${GET_MASTER_DATA}`
|
||||
);
|
||||
return data;
|
||||
};
|
||||
export const getDesignation = async (): Promise<any> => {
|
||||
const data = await axios.get(ALL_DESIGNATION).then((response) => response.data);
|
||||
return data;
|
||||
}
|
||||
|
||||
export const getRagistrationState = async (): Promise<any> => {
|
||||
const data = await apiCall<any>(
|
||||
'get',
|
||||
`${GET_REGISTRATION_STATE}`
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
export const partnerShipSubmit = (
|
||||
payload: any
|
||||
): Promise<any> => {
|
||||
return apiCall<any>(
|
||||
'post',
|
||||
PARTNER_API_ENDPOINT,
|
||||
payload,
|
||||
);
|
||||
};
|
||||
|
||||
export const registerContractor = async (payload: any): Promise<any> => {
|
||||
console.log("registerContractor payload : ", payload)
|
||||
try {
|
||||
const response = await axios.post(SAVE_CONTRACTOR_STAGE1, { ...payload, device: "mobileApp" });
|
||||
return response.data;
|
||||
} catch (error: any) {
|
||||
throw error.response?.data || error.message;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const sendAadhaarOtp = (
|
||||
payload: any
|
||||
): Promise<any> => {
|
||||
return apiCall<any>('post', SEND_ADHAROTP, payload);
|
||||
};
|
||||
|
||||
|
||||
export type VerifyAadhaarOtpPayload = {
|
||||
otp: string;
|
||||
refNumber: string;
|
||||
};
|
||||
|
||||
export const verifyAadhaarOtp = (
|
||||
payload: {
|
||||
otp: string;
|
||||
refNumber: string;
|
||||
}
|
||||
): Promise<any> => {
|
||||
return apiCall<any>(
|
||||
'post',
|
||||
VERIFY_ADHAR,
|
||||
payload,
|
||||
);
|
||||
};
|
||||
|
||||
export type VerifyGstPayload = {
|
||||
gstNumber: string;
|
||||
};
|
||||
|
||||
export const verifyGstNumber = (
|
||||
payload: {
|
||||
gstNumber: string;
|
||||
}
|
||||
): Promise<any> => {
|
||||
return apiCall<any>(
|
||||
'post',
|
||||
VERIFY_GST,
|
||||
payload,
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
export const submitEnvelopeA = async (payload: any) => {
|
||||
console.log('SUBMIT ENVELOPE A API CALLED', payload)
|
||||
const { data } = await apiCall<any>('post', SUBMIT_ENVELOPE_A, payload)
|
||||
console.log("data : ", data)
|
||||
return data
|
||||
}
|
||||
export const submitEnvelopeB = async (payload: any) => {
|
||||
console.log('SUBMIT ENVELOPE B API CALLED', payload)
|
||||
const { data } = await apiCall<any>('post', SUBMIT_ENVELOPE_B, payload)
|
||||
console.log("data : ", data)
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
export const uploadEnvelopeFile = async ({
|
||||
activeEnvelope,
|
||||
file,
|
||||
payload,
|
||||
}: UploadArgs) => {
|
||||
const formData = new FormData()
|
||||
|
||||
formData.append('files', {
|
||||
uri: file.uri,
|
||||
name: file.name,
|
||||
type: file.type,
|
||||
} as any)
|
||||
|
||||
formData.append('requestDto', JSON.stringify(payload))
|
||||
|
||||
const url =
|
||||
activeEnvelope === 'B' ? SUBMIT_ENVELOPE_FILE_B : SUBMIT_ENVELOPE_FILE_A
|
||||
|
||||
const data = await apiCall('post', url, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
})
|
||||
|
||||
return data
|
||||
}
|
||||
Reference in New Issue
Block a user