(bugfix) billAction: file type validation was failing if not file was attached
This commit is contained in:
@@ -165,7 +165,7 @@ export const updateOrAddBill = withUser(async (user: AuthenticatedUser, location
|
||||
}
|
||||
|
||||
// Validate file type
|
||||
if (attachmentFile && attachmentFile.type !== 'application/pdf') {
|
||||
if (attachmentFile && attachmentFile.size > 0 && attachmentFile.type !== 'application/pdf') {
|
||||
return { success: false, error: 'Only PDF files are accepted' };
|
||||
}
|
||||
|
||||
@@ -503,7 +503,7 @@ export const uploadProofOfPayment = async (locationID: string, billID: string, f
|
||||
}
|
||||
|
||||
// Validate file type
|
||||
if (file && file.type !== 'application/pdf') {
|
||||
if (attachmentFile && attachmentFile.size > 0 && attachmentFile.type !== 'application/pdf') {
|
||||
return { success: false, error: 'Only PDF files are accepted' };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user