Functions deletelistresult
, deletewordresult
, addlistresult
, addwordresult
should be exported from the src/external/redux/helpers
file.
deleteListResult
must get a state and list to delete as arguments.
This method must return the updated state, filtering the lists LISTS
and WORDS
.
LISTS
must be filtered by the element’s key
property, WORDS
- by listKey
.
deleteWordResult
should receive a state and word for removal as arguments.
This method must return the updated state by filtering the WORDS
list on the element’s word
field.
The addListResult
must get a state and list to add as arguments.
If the list already exists, you need to update only the error field - There is already a list with this name
.
If the list name is not or it is an empty string - the error is List name is empty
.
The addWordResult
method should receive a state and word object to add as arguments.
If the word in the word
property already exists in the list - the error is This word is already there
.
Also update the LISTS
And WORDS
values in Async Storage for each change.
This task is part of the Full-Stack JavaScript Course.
If you have any issues with it, you can ask for community help below the post.
Feel free to help others if you’ve already solved the task.