before merge
This commit is contained in:
@@ -64,6 +64,7 @@ const ITEM_DOCUMENT_DOWNLOAD = `${BASE_URL_Auction}api/auction/home/downloadDocu
|
||||
const DASHBOARD_COUNT = `${BASE_URL_Auction}api/auction/home/dashboard/counts`
|
||||
const AUCTION_ONE_TIME_BID =`${BASE_URL_Auction}api/bidding/getBidForAuction`
|
||||
|
||||
|
||||
//tender
|
||||
|
||||
const TENDER_LOGIN = `${BASE_URL}eproc/loginWithoutDecryption`
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { fetchAuctionItem, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseTender, offlineAuctionPurchase, userLogin } from './apis';
|
||||
import { fetchDashboard, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseTender, offlineAuctionPurchase, userLogin, offlineTenderPurchase, fetchTenderById, proceedToBid } from './apis';
|
||||
import { contractorStageThreeSubmit, contractorStageTwoSubmit, fetchAuctionItem, fetchCityDropdown, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchMasterData, fetchPurchaseAuction, fetchPurchaseTender, fetchTenderById, getDesignation, getRagistrationState, offlineAuctionPurchase, offlineTenderPurchase, proceedToBid, registerContractor, sendAadhaarOtp, userAuctionLogin, userLogin, verifyAadhaarOtp, verifyGstNumber, verifyPanHandler } 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 = () => {
|
||||
@@ -120,4 +127,84 @@ export const useProceedToBid = (tenderId?: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const useAuctionItem = () => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: any) => fetchAuctionItem(payload),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// EMD
|
||||
export const useEmdCheck = () => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: any) => fetchEmdCheck(payload),
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetDesignation = () => {
|
||||
return useQuery({
|
||||
queryKey: ['Designation'],
|
||||
queryFn: () => getDesignation()
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
export const useRegisterContractor = () => {
|
||||
return useMutation({
|
||||
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,
|
||||
});
|
||||
+152
-1
@@ -1,9 +1,19 @@
|
||||
import axios from "axios";
|
||||
import { DASHBOARD_COUNT, EMD_CHECK, FORARD_AUCTION_ITEM, GET_MY_AUCTION, GET_MY_TENDER, GET_TENDER_DETAILS, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PROCEED_PURCHASE_AUCTION, PROCEED_TO_BID, PURCHASE_OFFLINE_AUCTION, PURCHASE_TENDER_OFFLINE, REVERSE_AUCTION_ITEM, TENDER_LOGIN } from "./ApiUrls";
|
||||
import { ALL_DESIGNATION, DASHBOARD_COUNT, EMD_CHECK, FORARD_AUCTION_ITEM, GET_MASTER_DATA, GET_MY_AUCTION, GET_MY_TENDER, GET_REGISTRATION_STATE, GET_TENDER_DETAILS, GETCONTRACTORBYSTATE, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PROCEED_PURCHASE_AUCTION, PROCEED_TO_BID, PURCHASE_OFFLINE_AUCTION, PURCHASE_TENDER_OFFLINE, REJ_STAGE_TWO, REVERSE_AUCTION_ITEM, SAVE_CONTRACTOR_STAGE1, SEND_ADHAROTP, STAGETHREE, TENDER_LOGIN, VERIFY_ADHAR, VERIFY_GST,VERIFY_ORGPAN } from "./ApiUrls";
|
||||
import { apiCall } from "../../Axios/Axios";
|
||||
|
||||
// User
|
||||
|
||||
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 {
|
||||
// const response = await axios.post(LOG_IN_URL, { ...payload, divice: "mobileApp" });
|
||||
@@ -13,7 +23,24 @@ export const userLogin = async (payload: { emailAdd: string, password: string })
|
||||
throw error.response?.data || error.message;
|
||||
}
|
||||
};
|
||||
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 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 fetchDashboard = async (): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${DASHBOARD_COUNT}`);
|
||||
return data
|
||||
@@ -110,3 +137,127 @@ export const proceedToBid = async (tenderId: string): Promise<any> => {
|
||||
);
|
||||
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 fetchMasterData = async (): Promise<any> => {
|
||||
const data = await apiCall<any>(
|
||||
'get',
|
||||
`${GET_MASTER_DATA}`
|
||||
);
|
||||
return 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 verifyPanHandler = (
|
||||
payload: {
|
||||
dob: string;
|
||||
name: string;
|
||||
panNumber: string;
|
||||
}
|
||||
): Promise<any> => {
|
||||
return apiCall<any>(
|
||||
'post',
|
||||
VERIFY_ORGPAN,
|
||||
payload,
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
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 contractorStageTwoSubmit = (
|
||||
fileData: any
|
||||
): Promise<any> => {
|
||||
return apiCall<any>(
|
||||
'post',
|
||||
REJ_STAGE_TWO,
|
||||
fileData,
|
||||
undefined,
|
||||
'multipart/form-data'
|
||||
);
|
||||
};
|
||||
|
||||
export const contractorStageThreeSubmit = (
|
||||
payload: any
|
||||
): Promise<any> => {
|
||||
return apiCall<any>(
|
||||
'post',
|
||||
STAGETHREE,
|
||||
payload,
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user