2020-07-15 00:44:42 +01:00
|
|
|
import {
|
|
|
|
SAVE_USER_PROFILE_INFORMATION_FETCH_REQUEST,
|
|
|
|
SAVE_USER_PROFILE_INFORMATION_FETCH_SUCCESS,
|
|
|
|
SAVE_USER_PROFILE_INFORMATION_FETCH_FAIL,
|
2020-10-16 22:25:37 +01:00
|
|
|
RESEND_USER_CONFIRMATION_EMAIL_SUCCESS,
|
2020-07-15 00:44:42 +01:00
|
|
|
} from '../actions/user'
|
|
|
|
import { Map as ImmutableMap } from 'immutable'
|
|
|
|
|
|
|
|
const initialState = ImmutableMap({
|
|
|
|
isLoading: false,
|
|
|
|
isError: false,
|
2020-10-16 22:25:37 +01:00
|
|
|
emailConfirmationResends: 0,
|
2020-07-15 00:44:42 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
export default function (state = initialState, action) {
|
|
|
|
switch (action.type) {
|
|
|
|
case SAVE_USER_PROFILE_INFORMATION_FETCH_REQUEST:
|
|
|
|
return state.set('isLoading', true)
|
|
|
|
case SAVE_USER_PROFILE_INFORMATION_FETCH_SUCCESS:
|
|
|
|
return state
|
|
|
|
case SAVE_USER_PROFILE_INFORMATION_FETCH_FAIL:
|
|
|
|
return state.set('isError', true)
|
2020-10-16 22:25:37 +01:00
|
|
|
case RESEND_USER_CONFIRMATION_EMAIL_SUCCESS:
|
|
|
|
return state.set('emailConfirmationResends', state.get('emailConfirmationResends') + 1)
|
2020-07-15 00:44:42 +01:00
|
|
|
default:
|
|
|
|
return state
|
|
|
|
}
|
|
|
|
}
|