| 123456789101112131415161718 |
- import { apiSlice } from "@features/api/apiSlice";
-
- export const postsApiSlice = apiSlice.injectEndpoints({
- endpoints: (builder) => ({
- allPosts: builder.query({
- query: () => ({
- url: "/posts?populate=*",
- }),
- }),
- singlePost: builder.query({
- query: (postId) => ({
- url: `/posts/${postId}?populate=*`,
- }),
- }),
- }),
- });
-
- export const { useAllPostsQuery, useSinglePostQuery } = postsApiSlice;
|