mirror of
https://github.com/umami-software/umami.git
synced 2026-02-14 09:35:36 +01:00
37 lines
877 B
TypeScript
37 lines
877 B
TypeScript
import { TypeConfirmationForm } from '@/components/common/TypeConfirmationForm';
|
|
import { useMessages, useUpdateQuery } from '@/components/hooks';
|
|
|
|
const CONFIRM_VALUE = 'RESET';
|
|
|
|
export function WebsiteResetForm({
|
|
websiteId,
|
|
onSave,
|
|
onClose,
|
|
}: {
|
|
websiteId: string;
|
|
onSave?: () => void;
|
|
onClose?: () => void;
|
|
}) {
|
|
const { formatMessage, labels } = useMessages();
|
|
const { mutateAsync, isPending, error } = useUpdateQuery(`/websites/${websiteId}/reset`);
|
|
|
|
const handleConfirm = async () => {
|
|
await mutateAsync(null, {
|
|
onSuccess: async () => {
|
|
onSave?.();
|
|
onClose?.();
|
|
},
|
|
});
|
|
};
|
|
|
|
return (
|
|
<TypeConfirmationForm
|
|
confirmationValue={CONFIRM_VALUE}
|
|
onConfirm={handleConfirm}
|
|
onClose={onClose}
|
|
isLoading={isPending}
|
|
error={error}
|
|
buttonLabel={formatMessage(labels.reset)}
|
|
/>
|
|
);
|
|
}
|