This commit is contained in:
@@ -48,7 +48,7 @@ const DriverSignature = () => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', blob, `${fileName}.jpg`);
|
||||
|
||||
CustomerService.uploadAvatar(fileName, formData, {
|
||||
CustomerService.uploadDriverSignature(fileName, formData, {
|
||||
year: moment(signatureRequest?.route_date).format('YYYY')
|
||||
}).then(() => {
|
||||
SignatureRequestService.updateSignatureRequest(signatureRequest?.id, { status: 'done'}).then(() => {
|
||||
|
||||
@@ -36,7 +36,7 @@ const deleteClient = (id, data) => {
|
||||
return http.put(`/clients/${id}`, data);
|
||||
}
|
||||
|
||||
const uploadAvatar = (filename, data, options = {}) => {
|
||||
const uploadDriverSignature = (filename, data, options = {}) => {
|
||||
const safeFilename = `${filename || ''}`.trim();
|
||||
if (!safeFilename || safeFilename.includes('undefined') || safeFilename.includes('null')) {
|
||||
throw new Error('Invalid upload filename for avatar/signature.');
|
||||
@@ -46,6 +46,14 @@ const uploadAvatar = (filename, data, options = {}) => {
|
||||
})
|
||||
}
|
||||
|
||||
const uploadAvatar = (filename, data) => {
|
||||
const safeFilename = `${filename || ''}`.trim();
|
||||
if (!safeFilename || safeFilename.includes('undefined') || safeFilename.includes('null')) {
|
||||
throw new Error('Invalid upload filename for avatar/signature.');
|
||||
}
|
||||
return http.post(`/files/upload-general/${encodeURIComponent(safeFilename)}`, data);
|
||||
}
|
||||
|
||||
const getAvatar = (filename) => {
|
||||
return http.get(`/files/${filename}`);
|
||||
}
|
||||
@@ -94,6 +102,7 @@ const getFileDownloadUrl = (fileUrl) => {
|
||||
export const CustomerService = {
|
||||
getAllActiveCustomers,
|
||||
uploadAvatar,
|
||||
uploadDriverSignature,
|
||||
getAvatar,
|
||||
getAvatarAsBlob,
|
||||
deleteFile,
|
||||
|
||||
Reference in New Issue
Block a user