mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 07:37:11 +01:00
Get localized error messages.
This commit is contained in:
parent
baba06c692
commit
fc01ee9f56
32 changed files with 90 additions and 85 deletions
|
|
@ -13,7 +13,7 @@ export function PixelDeleteButton({
|
|||
name: string;
|
||||
onSave?: () => void;
|
||||
}) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { formatMessage, labels, getErrorMessage } = useMessages();
|
||||
const { mutate, isPending, error } = useDeleteQuery(`/pixels/${pixelId}`);
|
||||
const { touch } = useModified();
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ export function PixelDeleteButton({
|
|||
target: name,
|
||||
})}
|
||||
isLoading={isPending}
|
||||
error={error}
|
||||
error={getErrorMessage(error)}
|
||||
onConfirm={handleConfirm.bind(null, close)}
|
||||
onClose={close}
|
||||
buttonLabel={formatMessage(labels.delete)}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export function PixelEditForm({
|
|||
onSave?: () => void;
|
||||
onClose?: () => void;
|
||||
}) {
|
||||
const { formatMessage, labels, messages } = useMessages();
|
||||
const { formatMessage, labels, messages, getErrorMessage } = useMessages();
|
||||
const { mutate, error, isPending, touch, toast } = useUpdateQuery(
|
||||
pixelId ? `/pixels/${pixelId}` : '/pixels',
|
||||
{
|
||||
|
|
@ -74,7 +74,7 @@ export function PixelEditForm({
|
|||
}
|
||||
|
||||
return (
|
||||
<Form onSubmit={handleSubmit} error={error?.message} defaultValues={{ slug, ...data }}>
|
||||
<Form onSubmit={handleSubmit} error={getErrorMessage(error)} defaultValues={{ slug, ...data }}>
|
||||
{({ setValue }) => {
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue