Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
583 B
68
Indexable
Never
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;