plug Album duck to global redux store
parent
14ce07b9ab
commit
e4491fb43d
|
|
@ -0,0 +1,5 @@
|
||||||
|
import albumReducer from './reducers'
|
||||||
|
export { default as albumTypes } from './types'
|
||||||
|
export { default as albumActions } from './actions'
|
||||||
|
|
||||||
|
export default albumReducer
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue