diff --git a/08_lesson/src/features/posts/PostsList.js b/08_lesson/src/features/posts/PostsList.js index a4bbd43..9262dca 100644 --- a/08_lesson/src/features/posts/PostsList.js +++ b/08_lesson/src/features/posts/PostsList.js @@ -3,18 +3,26 @@ import { useGetPostsQuery } from './postsSlice'; const PostsList = () => { const { - data: posts, + postsIds, isLoading, isSuccess, isError, error - } = useGetPostsQuery('getPosts') + } = useGetPostsQuery('getPosts', { + selectFromResult: ({ data, isLoading, isSuccess, isError, error }) => ({ + postsIds: data?.ids, + isLoading, + isSuccess, + isError, + error, + }), + }) let content; if (isLoading) { content =
"Loading..."
; } else if (isSuccess) { - content = posts.ids.map(postId =>{error}
; }