Added suspense to LocationAddPage and LocationDetelePage
This commit is contained in:
@@ -4,7 +4,6 @@ import { FC } from "react";
|
||||
import { BillingLocation } from "../lib/db-types";
|
||||
import { deleteLocationById } from "../lib/actions/locationActions";
|
||||
import { useFormState } from "react-dom";
|
||||
import { Main } from "./Main";
|
||||
import { gotoUrl } from "../lib/actions/navigationActions";
|
||||
import Link from "next/link";
|
||||
|
||||
@@ -23,20 +22,18 @@ export const LocationDeleteForm:FC<LocationDeleteFormProps> = ({ location }) =>
|
||||
};
|
||||
|
||||
return(
|
||||
<Main>
|
||||
<div className="card card-compact card-bordered min-w-[20em] max-w-[90em] bg-base-100 shadow-s my-1">
|
||||
<div className="card-body">
|
||||
<form action={dispatch}>
|
||||
<p className="py-6 px-6">
|
||||
Please confirm deletion of location “<strong>{location.name}</strong>”.
|
||||
</p>
|
||||
<div className="pt-4 text-center">
|
||||
<button className="btn btn-primary">Confim</button>
|
||||
<Link className="btn btn-neutral ml-3" href={`/location/${location._id}/edit/`}>Cancel</Link>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div className="card card-compact card-bordered min-w-[20em] max-w-[90em] bg-base-100 shadow-s my-1">
|
||||
<div className="card-body">
|
||||
<form action={dispatch}>
|
||||
<p className="py-6 px-6">
|
||||
Please confirm deletion of location “<strong>{location.name}</strong>”.
|
||||
</p>
|
||||
<div className="pt-4 text-center">
|
||||
<button className="btn btn-primary">Confim</button>
|
||||
<Link className="btn btn-neutral ml-3" href={`/location/${location._id}/edit/`}>Cancel</Link>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</Main>
|
||||
)
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ export type LocationEditFormProps = {
|
||||
/** location which should be edited */
|
||||
location: BillingLocation,
|
||||
/** year adn month at a new billing location should be assigned */
|
||||
yearMonth: undefined
|
||||
yearMonth?: undefined
|
||||
} | {
|
||||
/** location which should be edited */
|
||||
location: undefined,
|
||||
location?: undefined,
|
||||
/** year adn month at a new billing location should be assigned */
|
||||
yearMonth: YearMonth
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user