Skip to content

Commit

Permalink
fix: Invalidation repositories after delete
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-dalmet committed Dec 21, 2023
1 parent 9c09299 commit f3dfa73
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/features/repositories/PageAdminRepository.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@ export default function PageAdminRepository() {
const { t } = useTranslation(['common', 'repositories']);

const toastError = useToastError();
const trpcUtils = trpc.useUtils();

const router = useRouter();
const params = useParams();
const repository = trpc.repositories.getById.useQuery({
id: params?.id?.toString() ?? '',
});

const repositoryRemove = trpc.repositories.removeById.useMutation({
onSuccess: () => {
router.back();
onSuccess: async () => {
await trpcUtils.repositories.invalidate();
router.replace(`${ADMIN_PATH}/repositories`);
},
onError: () => {
toastError({
Expand Down

1 comment on commit f3dfa73

@vercel
Copy link

@vercel vercel bot commented on f3dfa73 Dec 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.