plug Album duck to global redux store

develop
TBS093A 2020-07-31 14:34:42 +02:00
parent 14ce07b9ab
commit e4491fb43d
4 changed files with 13 additions and 4 deletions

View File

@ -0,0 +1,5 @@
import albumReducer from './reducers'
export { default as albumTypes } from './types'
export { default as albumActions } from './actions'
export default albumReducer

View File

@ -1,9 +1,11 @@
import { combineReducers } from 'redux' import { combineReducers } from 'redux'
import userReducer from './user/duck' import userReducer from './user/duck'
import albumReducer from './album/duck'
const rootReducer = combineReducers({ const rootReducer = combineReducers({
user: userReducer user: userReducer,
album: albumReducer
}) })
export default rootReducer export default rootReducer

View File

@ -11,13 +11,15 @@ export const store = createStore(rootReducer, persistedState, applyMiddleware(th
store.subscribe( () => { store.subscribe( () => {
saveState({ saveState({
user: store.getState().user user: store.getState().user,
album: store.getState().album
}) })
}) })
store.subscribe( loadash.throttle( () => { store.subscribe( loadash.throttle( () => {
saveState({ saveState({
user: store.getState().user user: store.getState().user,
album: store.getState().album
}) })
}, 1000)) }, 1000))

View File

@ -42,7 +42,7 @@ export const postAuth = (username, password) => async (dispatch) => {
} }
} }
export const deleteAuth = (token) => async (dispatch) => { export const deleteAuth = (token) => async (dispatch) => {
try { try {
response = await AppService._delete( response = await AppService._delete(
endpoint + 'auth', endpoint + 'auth',