Profile Image edit

This commit is contained in:
2024-07-27 21:00:31 +02:00
parent 15ca7e8879
commit 627654e0a7
18 changed files with 368 additions and 38 deletions
+6 -5
View File
@@ -17,7 +17,7 @@ import {
Typography,
} from '@mui/material';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { Link } from '@tanstack/react-router';
import { Link, useNavigate } from '@tanstack/react-router';
import { FC, useState } from 'react';
import { useTranslation } from 'react-i18next';
import Api from '../../api/Api';
@@ -42,9 +42,9 @@ const Post: FC<Props> = ({ post }) => {
},
});
const queryClient = useQueryClient();
const { t } = useTranslation();
const queryClient = useQueryClient();
const navigate = useNavigate();
return (
<Card>
@@ -121,10 +121,11 @@ const Post: FC<Props> = ({ post }) => {
color="error"
onClick={() => {
deleteMutation.mutate(post.id, {
onSuccess: () => {
queryClient.invalidateQueries({
onSuccess: async (data) => {
await queryClient.invalidateQueries({
queryKey: ['posts'],
});
navigate({ to: '/', search: { page: data.pages - 1 } });
},
onError: setError,
});