Missign translation
This commit is contained in:
@@ -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')} />
|
||||
|
||||
Reference in New Issue
Block a user