BugFix: delete button did not use locale path prefix

This commit is contained in:
2024-02-19 10:21:25 +01:00
parent dead2e1200
commit 160c4f00f5
2 changed files with 6 additions and 4 deletions

View File

@@ -6,7 +6,7 @@ import { BillingLocation, YearMonth } from "../lib/db-types";
import { updateOrAddLocation } from "../lib/actions/locationActions";
import { useFormState } from "react-dom";
import Link from "next/link";
import { useTranslations } from "next-intl";
import { useLocale, useTranslations } from "next-intl";
export type LocationEditFormProps = {
/** location which should be edited */
@@ -26,6 +26,7 @@ export const LocationEditForm:FC<LocationEditFormProps> = ({ location, yearMonth
const handleAction = updateOrAddLocation.bind(null, location?._id, location?.yearMonth ?? yearMonth);
const [ state, dispatch ] = useFormState(handleAction, initialState);
const t = useTranslations("location-edit-form");
const locale = useLocale();
let { year, month } = location ? location.yearMonth : yearMonth;
@@ -35,7 +36,7 @@ export const LocationEditForm:FC<LocationEditFormProps> = ({ location, yearMonth
<form action={dispatch}>
{
location &&
<Link href={`/location/${location._id}/delete`} className="absolute bottom-5 right-4 tooltip" data-tip={t("delete-tooltip")}>
<Link href={`/${locale}/location/${location._id}/delete`} className="absolute bottom-5 right-4 tooltip" data-tip={t("delete-tooltip")}>
<TrashIcon className="h-[1em] w-[1em] text-error text-2xl" />
</Link>
}