actions.ts
3 years ago
index.ts
2 years ago
reducer.ts
3 years ago
selectors.ts
3 years ago
types.ts
3 years ago
reducer.ts
21 lines
| 1 | import { SET_AUTHENTICATED, SetAuthenticatedAction } from './actions'; |
| 2 | import { AuthState, initialAuthState } from './types'; |
| 3 | |
| 4 | export default ( |
| 5 | state: AuthState = initialAuthState, |
| 6 | action: SetAuthenticatedAction |
| 7 | ): AuthState => { |
| 8 | switch ( action.type ) { |
| 9 | case SET_AUTHENTICATED: |
| 10 | return { |
| 11 | ...state, |
| 12 | mediaSourceIsAuthenticated: state.mediaSourceIsAuthenticated.set( |
| 13 | action.payload.mediaSource, |
| 14 | action.payload.isAuthenticated |
| 15 | ), |
| 16 | }; |
| 17 | default: |
| 18 | return state; |
| 19 | } |
| 20 | }; |
| 21 |