API & Client: dates handling

This commit is contained in:
SamR1
2018-01-01 22:36:44 +01:00
parent ddb765e02d
commit 7c3ffa46bd
8 changed files with 30 additions and 14 deletions

View File

@ -23,8 +23,8 @@ function ProfileError(message) {
return { type: 'PROFILE_ERROR', message }
}
function PwdError(message) {
return { type: 'PWD_ERROR', message }
function ProfileUpdateError(message) {
return { type: 'PROFILE_UPDATE_ERROR', message }
}
function initProfileFormData(user) {
@ -157,7 +157,9 @@ export function handleProfileFormSubmit(event) {
const state = getState()
if (!state.formProfile.formProfile.password ===
state.formProfile.formProfile.passwordConf) {
dispatch(PwdError('Password and password confirmation don\'t match.'))
dispatch(ProfileUpdateError(
'Password and password confirmation don\'t match.'
))
} else {
return mpwoApi
.updateProfile(state.formProfile.formProfile)
@ -166,7 +168,7 @@ export function handleProfileFormSubmit(event) {
getProfile(dispatch)
history.push('/profile')
} else {
dispatch(AuthError(ret.message))
dispatch(ProfileUpdateError(ret.message))
}
})
.catch(error => {