mirror of
https://github.com/umami-software/umami.git
synced 2026-02-23 05:55:35 +01:00
Changed route ids to be more explicit.
This commit is contained in:
parent
1a70350936
commit
18e36aa7b3
105 changed files with 86 additions and 76 deletions
|
|
@ -1,42 +0,0 @@
|
|||
import { useApi, useMessages } from 'components/hooks';
|
||||
import TypeConfirmationForm from 'components/common/TypeConfirmationForm';
|
||||
|
||||
const CONFIRM_VALUE = 'RESET';
|
||||
|
||||
export function WebsiteResetForm({
|
||||
websiteId,
|
||||
onSave,
|
||||
onClose,
|
||||
}: {
|
||||
websiteId: string;
|
||||
onSave?: () => void;
|
||||
onClose?: () => void;
|
||||
}) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { post, useMutation } = useApi();
|
||||
const { mutate, isPending, error } = useMutation({
|
||||
mutationFn: (data: any) => post(`/websites/${websiteId}/reset`, data),
|
||||
});
|
||||
|
||||
const handleConfirm = async () => {
|
||||
mutate(null, {
|
||||
onSuccess: async () => {
|
||||
onSave?.();
|
||||
onClose?.();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<TypeConfirmationForm
|
||||
confirmationValue={CONFIRM_VALUE}
|
||||
onConfirm={handleConfirm}
|
||||
onClose={onClose}
|
||||
isLoading={isPending}
|
||||
error={error}
|
||||
buttonLabel={formatMessage(labels.reset)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default WebsiteResetForm;
|
||||
Loading…
Add table
Add a link
Reference in a new issue