-
-
Save DuncanFaulkner/e3f4fac2a17ce6aa01c480bb191c8b73 to your computer and use it in GitHub Desktop.
delete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE_COURSE, | |
{ | |
update (cache, el) { | |
const deletedId = el.data?.deleteCourse.course?.id | |
const allCourses = cache.readQuery<GetAllCourses>({ query: GET_ALL_COURSES }); | |
cache.writeQuery({ | |
query: GET_ALL_COURSES, | |
data: { | |
todos: allCourses?.courses.filter((t) => t?.id !== deletedId) | |
} | |
}); | |
cache.evict({ id: el.data?.deleteCourse.course?.id }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment