adding new billing location completed

This commit is contained in:
2024-01-05 15:13:15 +01:00
parent 3f7b681ab9
commit 94fee6f775
6 changed files with 24 additions and 14 deletions

View File

@@ -9,13 +9,15 @@ import { gotoHome } from "../lib/billActions";
export interface LocationEditFormProps {
/** location which should be edited */
location?: BillingLocation
location?: BillingLocation,
/** year month at a new billing location should be assigned */
yearMonth?: string
}
export const LocationEditForm:FC<LocationEditFormProps> = ({ location }) =>
export const LocationEditForm:FC<LocationEditFormProps> = ({ location, yearMonth }) =>
{
const initialState = { message: null, errors: {} };
const handleAction = updateOrAddLocation.bind(null, location?._id);
const handleAction = updateOrAddLocation.bind(null, location?._id, yearMonth);
const [ state, dispatch ] = useFormState(handleAction, initialState);
// redirect to the main page