In the upcoming lecture will be adding catch blocks to our state/action-creators/index.ts file. Similarly to issues seen throughout the course now, we will need to add some type guards.
Find the fetchCells action creator's catch block and refactor it to look like this:
...
} catch (err) {
if (err instanceof Error) {
dispatch({
type: ActionType.FETCH_CELLS_ERROR,
payload: err.message,
});
}
}
...Find the saveCells action creator's catch block and refactor it to look like this:
...
} catch (err) {
if (err instanceof Error) {
dispatch({
type: ActionType.SAVE_CELLS_ERROR,
payload: err.message,
});
}
}
...