[ABANDONED] React/Redux front end for the Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

28 lines
747 B

import { Reducer } from 'redux'
import { AuthenticationActions } from '../actions/authentication'
import { AuthenticationState } from '../types'
const initialState: AuthenticationState = {
authenticated: false,
userId: undefined,
}
const reducer: Reducer<AuthenticationState, AuthenticationActions> = (state = initialState, action) => {
switch (action.type) {
case 'AUTHENTICATION_SET_AUTHENTICATED':
return {
...state,
authenticated: action.payload,
}
case 'AUTHENTICATION_SET_USER':
return {
...state,
userId: action.payload,
}
default:
return state
}
}
export default reducer