Merge branch 'entity-actions-delete' into 'develop'
useEntityActions: ensure the delete gets dispatched See merge request soapbox-pub/soapbox!2354
This commit is contained in:
commit
a83cfe7ddd
1 changed files with 3 additions and 1 deletions
|
@ -2,7 +2,7 @@ import { z } from 'zod';
|
||||||
|
|
||||||
import { useApi, useAppDispatch } from 'soapbox/hooks';
|
import { useApi, useAppDispatch } from 'soapbox/hooks';
|
||||||
|
|
||||||
import { importEntities } from '../actions';
|
import { deleteEntities, importEntities } from '../actions';
|
||||||
|
|
||||||
import type { Entity } from '../types';
|
import type { Entity } from '../types';
|
||||||
import type { EntitySchema } 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);
|
if (!endpoints.delete) return Promise.reject(endpoints);
|
||||||
return api.delete(endpoints.delete.replaceAll(':id', entityId)).then((response) => {
|
return api.delete(endpoints.delete.replaceAll(':id', entityId)).then((response) => {
|
||||||
|
|
||||||
|
dispatch(deleteEntities([entityId], entityType));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
response,
|
response,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue