Created
September 1, 2017 03:17
-
-
Save esparkman/d906567754d935c8fd4bdb36f07176ad to your computer and use it in GitHub Desktop.
Conditionally check each key on the payload object?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
updateCustomer ({commit}, payload) { | |
commit('setLoading', true) | |
const customer = {} | |
if (payload.first_name) { | |
customer.first_name = payload.first_name | |
} | |
if (payload.last_name) { | |
customer.last_name = payload.last_name | |
} | |
if (payload.gender) { | |
customer.gender = payload.gender | |
} | |
if (payload.email) { | |
customer.email = payload.email | |
} | |
if (payload.phone) { | |
customer.phone = payload.phone | |
} | |
if (payload.address1) { | |
customer.address1 = payload.address1 | |
} | |
if (payload.address2) { | |
customer.address2 = payload.address2 | |
} | |
if (payload.city) { | |
customer.city = payload.city | |
} | |
if (payload.state) { | |
customer.state = payload.state | |
} | |
if (payload.zipcode) { | |
customer.zipcode = payload.zipcode | |
} | |
if (payload.notes) { | |
customer.notes = payload.notes | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment