year & month replaced by yearMonth object
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { TrashIcon } from "@heroicons/react/24/outline";
|
||||
import { FC } from "react";
|
||||
import { BillingLocation } from "../lib/db-types";
|
||||
import { BillingLocation, YearMonth } from "../lib/db-types";
|
||||
import { updateOrAddLocation } from "../lib/actions/locationActions";
|
||||
import { useFormState } from "react-dom";
|
||||
import { gotoHome } from "../lib/actions/billActions";
|
||||
@@ -10,16 +10,14 @@ import { gotoHome } from "../lib/actions/billActions";
|
||||
export interface LocationEditFormProps {
|
||||
/** location which should be edited */
|
||||
location?: BillingLocation,
|
||||
/** year at a new billing location should be assigned */
|
||||
year?: string
|
||||
/** month at a new billing location should be assigned */
|
||||
month?: string
|
||||
/** year adn month at a new billing location should be assigned */
|
||||
yearMonth?: YearMonth
|
||||
}
|
||||
|
||||
export const LocationEditForm:FC<LocationEditFormProps> = ({ location, year, month }) =>
|
||||
export const LocationEditForm:FC<LocationEditFormProps> = ({ location, yearMonth }) =>
|
||||
{
|
||||
const initialState = { message: null, errors: {} };
|
||||
const handleAction = updateOrAddLocation.bind(null, location?._id, year, month);
|
||||
const handleAction = updateOrAddLocation.bind(null, location?._id, yearMonth);
|
||||
const [ state, dispatch ] = useFormState(handleAction, initialState);
|
||||
|
||||
// redirect to the main page
|
||||
|
||||
Reference in New Issue
Block a user