Missign translation

This commit is contained in:
2024-07-27 01:39:52 +02:00
parent 581cacb636
commit 683b6020b7
12 changed files with 55 additions and 20 deletions
+14 -2
View File
@@ -31,6 +31,8 @@ interface Props {
const Post: FC<Props> = ({ post }) => {
const [open, setOpen] = useState(false);
//eslint-disable-next-line @typescript-eslint/no-explicit-any
const [error, setError] = useState<any>();
const deleteMutation = useMutation({
mutationFn: (id: number) => {
@@ -112,6 +114,7 @@ const Post: FC<Props> = ({ post }) => {
queryKey: ['posts'],
});
},
onError: setError,
});
setOpen(false);
}}
@@ -123,9 +126,18 @@ const Post: FC<Props> = ({ post }) => {
</>
)}
</CardActions>
<Snackbar open={deleteMutation.isError} autoHideDuration={2000} onClose={() => deleteMutation.reset()}>
<Snackbar
open={deleteMutation.isError}
autoHideDuration={2000}
onClose={() => {
deleteMutation.reset();
}}
TransitionProps={{
onExited: () => setError(undefined),
}}
>
<Alert severity="error" variant="filled" sx={{ width: '100%' }}>
{deleteMutation.isError && <ErrorComponent error={deleteMutation.error} context="delete" />}
{error && <ErrorComponent error={error} context="delete" color="white" />}
</Alert>
</Snackbar>
<Snackbar open={deleteMutation.isPending} message={t('Deleting')} />