While making user register form by vuejs, I made ugly code.
I want to refactor nicely, but lack of idea. Because of adding vuejs from the legacy code, I was not able to use vue cli. So I embedded vuejs with <script>
tag.
what I want to make a class is
newUser : {
"email": '',
"firstName": '',
"lastName": '',
"additionalInfo":{
"phone": '',
"description":''
},
"authority":"TENANT_ADMIN",
"tenantId":{
"entityType": "TENANT",
"id": ''
},
"customerId": {
"entityType": "CUSTOMER",
"id": ''
}
}
Here is my code.
https://codepen.io/pen/?editors=1111#
To clear existing form, I did manually clear it's property.
When I tried to reset with this.newUser = {}
, it delete all my properties. But I do want to that.
How can I nicely refactor my code?