Skip to content
Snippets Groups Projects
Commit a7ba9169 authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

refactor(change-password): add API endpoint

parent 1d1143b2
No related branches found
No related tags found
1 merge request!14Sprint #15
import { actions } from 'pubsweet-client' import { actions } from 'pubsweet-client'
import { SubmissionError } from 'redux-form' import { SubmissionError } from 'redux-form'
import { get, find, capitalize, pick } from 'lodash' import { get, find, capitalize, pick } from 'lodash'
import { update } from 'pubsweet-client/src/helpers/api' import { update, create } from 'pubsweet-client/src/helpers/api'
export const parseTitle = version => { export const parseTitle = version => {
const title = get(version, 'metadata.title') const title = get(version, 'metadata.title')
...@@ -147,9 +147,12 @@ export const onSubmitUser = (values, dispatch, { setEditMode }) => ...@@ -147,9 +147,12 @@ export const onSubmitUser = (values, dispatch, { setEditMode }) =>
}) })
.catch(handleFormError) .catch(handleFormError)
// Temporary till API implementation export const onSubmitChangePassword = (
export const onSubmitChangePassword = (values, dispatch, { history, user }) => { password, newPassword },
update(`/users/${values.id}`, parseUpdateUser(values)) dispatch,
{ history },
) =>
create(`/users/change-password`, { password, newPassword })
.then(() => { .then(() => {
history.goBack() history.goBack()
}) })
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment