stuctured envelopa and envelopb integration
This commit is contained in:
@@ -3,7 +3,15 @@ import { DASHBOARD_COUNT, GET_MY_AUCTION, GET_MY_TENDER, GET_TENDER_DETAILS, LIV
|
||||
import { apiCall } from "../../Axios/Axios";
|
||||
|
||||
// User
|
||||
|
||||
export type UploadArgs = {
|
||||
activeEnvelope: 'A' | 'B'
|
||||
file: {
|
||||
uri: string
|
||||
name: string
|
||||
type: string
|
||||
}
|
||||
payload: any
|
||||
}
|
||||
export const userLogin = async (payload: { emailAdd: string, password: string }): Promise<any> => {
|
||||
try {
|
||||
// const response = await axios.post(LOG_IN_URL, { ...payload, divice: "mobileApp" });
|
||||
@@ -85,14 +93,42 @@ export const proceedToBid = async (tenderId: string): Promise<any> => {
|
||||
}
|
||||
|
||||
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 submitEnvelopeFileB = async (payload: any) => {
|
||||
const { data } = await apiCall<any>('post', SUBMIT_ENVELOPE_FILE_B, payload)
|
||||
|
||||
|
||||
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