mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-14 09:48:10 -05:00
Update apiSlice.js
This commit is contained in:
@@ -2,17 +2,19 @@
|
|||||||
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
|
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
|
||||||
import { createSelector} from '@reduxjs/toolkit'
|
import { createSelector} from '@reduxjs/toolkit'
|
||||||
|
|
||||||
|
|
||||||
// Define our single API slice object
|
// Define our single API slice object
|
||||||
export const apiSlice = createApi({
|
export const apiSlice = createApi({
|
||||||
// The cache reducer expects to be added at `state.api` (already default - this is optional)
|
// The cache reducer expects to be added at `state.api` (already default - this is optional)
|
||||||
reducerPath: 'api',
|
reducerPath: 'api',
|
||||||
|
|
||||||
// All of our requests will have URLs starting with '/fakeApi'
|
// All of our requests will have URLs starting with '/fakeApi'
|
||||||
baseQuery: fetchBaseQuery({ baseUrl: process.env.REACT_APP_BACKEND_SERVER }),
|
baseQuery: fetchBaseQuery({ baseUrl: process.env.REACT_APP_BACKEND_SERVER }),
|
||||||
// The "endpoints" represent operations and requests for this server
|
// The "endpoints" represent operations and requests for this server
|
||||||
endpoints: builder => ({
|
endpoints: builder => ({
|
||||||
// The `getPosts` endpoint is a "query" operation that returns data
|
// The `getPosts` endpoint is a "query" operation that returns data
|
||||||
getGroups: builder.query({
|
getGroups: builder.query({
|
||||||
// The URL for the request is '/fakeApi/posts
|
// The URL for the request is '/fakeApi/posts'
|
||||||
query: (shortName) => ({ url: `/${shortName}/groups` })
|
query: (shortName) => ({ url: `/${shortName}/groups` })
|
||||||
}),
|
}),
|
||||||
getSystems: builder.query({
|
getSystems: builder.query({
|
||||||
|
|||||||
Reference in New Issue
Block a user