refactoring: changing param list of a fn
This commit is contained in:
@@ -109,7 +109,7 @@ const serializeAttachment = async (billAttachment: File | null) => {
|
||||
* @param formData form data
|
||||
* @returns
|
||||
*/
|
||||
export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationId: string, billId:string|undefined, billYear:number|undefined, prevState:State, formData: FormData) => {
|
||||
export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationId: string, billId:string|undefined, billYear:number|undefined, billMonth:number|undefined, prevState:State, formData: FormData) => {
|
||||
|
||||
const { id: userId } = user;
|
||||
|
||||
@@ -191,7 +191,9 @@ export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationI
|
||||
}
|
||||
});
|
||||
}
|
||||
await gotoHome(billYear ? `/?year=${billYear}` : undefined);
|
||||
if(billYear && billMonth ) {
|
||||
await gotoHome({ year: billYear, month: billMonth });
|
||||
}
|
||||
})
|
||||
|
||||
export const fetchBillById = withUser(async (user:AuthenticatedUser, locationID:string, billID:string) => {
|
||||
@@ -219,7 +221,7 @@ export const fetchBillById = withUser(async (user:AuthenticatedUser, locationID:
|
||||
return([billLocation, bill] as [BillingLocation, Bill]);
|
||||
})
|
||||
|
||||
export const deleteBillById = withUser(async (user:AuthenticatedUser, locationID:string, billID:string, year:number) => {
|
||||
export const deleteBillById = withUser(async (user:AuthenticatedUser, locationID:string, billID:string, year:number, month:number) => {
|
||||
|
||||
const { id: userId } = user;
|
||||
|
||||
@@ -240,6 +242,6 @@ export const deleteBillById = withUser(async (user:AuthenticatedUser, locationID
|
||||
}
|
||||
});
|
||||
|
||||
await gotoHome(`/?year=${year}`);
|
||||
await gotoHome({year, month});
|
||||
return(post.modifiedCount);
|
||||
});
|
||||
Reference in New Issue
Block a user