Commit b975c302 authored by Mycha de Vrees's avatar Mycha de Vrees
Browse files

usertransformer cleanup

parent 47869d6f
Pipeline #374 passed with stage
in 1 minute and 27 seconds
......@@ -15,19 +15,7 @@ function storeUserAccountData (account) {
}
return user
}
function transformUserData (response, type) {
return {
'id': response.data.id,
type,
...response.data.attributes
}
}
function transformPasswordData (data) {
return {
userId: data.userId,
postUserHashPassword: data.password
}
}
/**
* UserTransformer class
*/
......@@ -44,14 +32,22 @@ class UserTransformer extends Transformer {
/**
* Transform user response after updating profile
* @param response {object} Response to transform
* @param type {string} Type
* @return {object}
*/
static transformUser (response, type = '') {
return transformUserData(response, type)
return {
'id': response.data.id,
type,
...response.data.attributes
}
}
static transformPassword (body) {
return transformPasswordData(body)
return {
userId: body.userId,
postUserHashPassword: body.password
}
}
}
......
Supports Markdown
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