From 9fce8df04d2799eace79f6b298248f99c3da1f67 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Tue, 17 Jan 2023 20:56:48 -0500 Subject: [PATCH] Update apiSlice.js --- frontend/src/features/api/apiSlice.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/features/api/apiSlice.js b/frontend/src/features/api/apiSlice.js index 21375af..73fd0e5 100644 --- a/frontend/src/features/api/apiSlice.js +++ b/frontend/src/features/api/apiSlice.js @@ -2,17 +2,19 @@ import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' import { createSelector} from '@reduxjs/toolkit' + // Define our single API slice object export const apiSlice = createApi({ // The cache reducer expects to be added at `state.api` (already default - this is optional) reducerPath: 'api', + // All of our requests will have URLs starting with '/fakeApi' baseQuery: fetchBaseQuery({ baseUrl: process.env.REACT_APP_BACKEND_SERVER }), // The "endpoints" represent operations and requests for this server endpoints: builder => ({ // The `getPosts` endpoint is a "query" operation that returns data getGroups: builder.query({ - // The URL for the request is '/fakeApi/posts + // The URL for the request is '/fakeApi/posts' query: (shortName) => ({ url: `/${shortName}/groups` }) }), getSystems: builder.query({ @@ -34,7 +36,7 @@ const emptySystems = [] export const selectAllSystems = createSelector( selectSystemsResult, systemsResult => systemsResult?.data ?? emptySystems -) +) export const selectActiveSystems = createSelector( selectAllSystems,