Skip to content

Commit

Permalink
feat: connect rtk to store
Browse files Browse the repository at this point in the history
  • Loading branch information
SplitCode committed Oct 4, 2024
1 parent 1ab83ba commit f1de48c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/api/getChannels.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
import apiPath from './apiPath';

export const usersApi = createApi({
export const channelsApi = createApi({
reducerPath: 'channels',
baseQuery: fetchBaseQuery({ baseUrl: apiPath.channels() }),
endpoints: (builder) => ({
Expand All @@ -13,4 +13,4 @@ export const usersApi = createApi({

export const {
useGetChannelsQuery,
} = usersApi;
} = channelsApi;
4 changes: 4 additions & 0 deletions frontend/src/store/store.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { configureStore } from '@reduxjs/toolkit';
import { channelsApi } from '../api/getChannels';

import authReducer from './slices/authSlice';

const store = configureStore({
reducer: {
auth: authReducer,
[channelsApi.reducerPath]: channelsApi.reducer,
},
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(channelsApi.middleware),
});

export default store;

0 comments on commit f1de48c

Please sign in to comment.