From ffe351165417477a18d98a87e3e20493c625e850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Schubert=20D=2E=20Rodr=C3=ADguez?= <5466692+scrodrig@users.noreply.github.com> Date: Tue, 6 Feb 2024 00:32:15 +0000 Subject: [PATCH] Replace `PUT ` with `PATCH` After adding some reactions, everything works fine, after editing the `POST`, for instance, change the content, the reaction would be deleted since `PUT `replace the whole object --- 07_lesson/src/features/posts/postsSlice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/07_lesson/src/features/posts/postsSlice.js b/07_lesson/src/features/posts/postsSlice.js index f969166..d67a1fd 100644 --- a/07_lesson/src/features/posts/postsSlice.js +++ b/07_lesson/src/features/posts/postsSlice.js @@ -80,7 +80,7 @@ export const extendedApiSlice = apiSlice.injectEndpoints({ updatePost: builder.mutation({ query: initialPost => ({ url: `/posts/${initialPost.id}`, - method: 'PUT', + method: 'PATCH', body: { ...initialPost, date: new Date().toISOString()