Untitled

 avatar
unknown
plain_text
2 years ago
583 B
77
Indexable
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";

//redux toolkit query

export const api = createApi({
    baseQuery: fetchBaseQuery({
        baseUrl:/* process.env.REACT_APP_BASE_URL*/"http://localhost:5001"
    }),
    reducerPath: "adminApi",
    tagTypes: [
        "User"
    ],
    // get call with build.query
    endpoints: (build) => ({

        getUser: build.query({
            query: (id) => `general/user/${id}`,
            providesTags: ["User"],
        }),
    })
})

export const {
    useGetUserQuery,
} = api;
Editor is loading...