Working on a front-end application utilizing React, Typescript, Effector, FetchAPI, and other technologies. Created an Effector effect to delete an item in the backend:
export const deleteItemFX = createEffect({
handler: (id: string) => {
return fetch(itemUrl + id, {
method: "DELETE",
});
}
})
Now, when trying to utilize this effect in my React component by subscribing to its 'finally' event according to the official documentation:
deleteItemFX.finally.watch(({params, status, result}) => {
console.log('finally.watch called');
if (result.ok) {
result.json().then(() => {
message.success(t("delete_item.success"));
})
}
});
Encountering a type error during compilation:
Property 'result' does not exist on type '{ status: "done"; params: string; result: Response; } | { status: "fail"; params: string; error: Error; }'. TS2339
Seeking advice or suggestions on how to access the 'result' of the handler within the 'finally.watch' function.