useEntityActions: ensure the delete gets dispatched

develop^2
Alex Gleason 2023-03-15 14:04:29 -05:00
rodzic af69c7564e
commit 602a670b2e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -2,7 +2,7 @@ import { z } from 'zod';
import { useApi, useAppDispatch } from 'soapbox/hooks';
import { importEntities } from '../actions';
import { deleteEntities, importEntities } from '../actions';
import type { Entity } from '../types';
import type { EntitySchema } from './types';
@ -58,6 +58,8 @@ function useEntityActions<TEntity extends Entity = Entity, P = any>(
if (!endpoints.delete) return Promise.reject(endpoints);
return api.delete(endpoints.delete.replaceAll(':id', entityId)).then((response) => {
dispatch(deleteEntities([entityId], entityType));
return {
response,
};