Skip to content

Commit

Permalink
🎈 perf(Redux | Feedback Slice #17: Add feedbackReducer to root-reduce…
Browse files Browse the repository at this point in the history
…r and persist configuration):
  • Loading branch information
ballyalley-o committed May 11, 2024
1 parent 06d2a84 commit 87eee18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/store/root-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { combineReducers } from '@reduxjs/toolkit'
import { persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
import { KEY } from 'constant'
import { apiSlice, authReducer, bootcampReducer } from './slice'
import { apiSlice, authReducer, bootcampReducer, feedbackReducer } from './slice'

export const apiPersistConfig = {
key: 'api',
Expand Down Expand Up @@ -39,6 +39,13 @@ export const bootcampPersistConfig = {
blacklist: ['error', 'initial', 'responseMessage']
}

export const feedbackPersistConfig = {
key: 'feedback',
storage,
keyPrefix: KEY.PERSIST_PREFIX,
blacklist: ['error', 'initial', 'responseMessage']
}

export const coursePersistConfig = {
key: 'course',
storage,
Expand All @@ -49,7 +56,8 @@ export const coursePersistConfig = {
const rootReducer = combineReducers({
[apiSlice.reducerPath]: persistReducer(apiPersistConfig, apiSlice.reducer),
auth: persistReducer(authPersistConfig, authReducer),
bootcamp: persistReducer(bootcampPersistConfig, bootcampReducer)
bootcamp: persistReducer(bootcampPersistConfig, bootcampReducer),
feedback: persistReducer(feedbackPersistConfig, feedbackReducer)
})

export default rootReducer
1 change: 1 addition & 0 deletions src/store/slice/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { apiSlice } from './api'
export { default as authReducer } from './auth/auth'
export { default as bootcampReducer } from './bootcamp/bootcamp'
export { default as feedbackReducer } from './feedback/feedback'
export * from './bootcamp/endpoint'
export * from './auth/endpoint'
export * from './user/endpoint'
Expand Down

0 comments on commit 87eee18

Please sign in to comment.