how to optimize readability and simplification, here are two pieces of code:
the first paragraph of code
const defaultObj = {
content: {
},
};
defaultObj.content.address = res.after.temporary.address.data;
defaultObj.content.people = res.after.temporary.people.data;
defaultObj.content.stroke = res.after.temporary.stroke.data;
defaultObj.content.take = res.after.temporary.take.data;
second paragraph of code
switch (key) {
case "people": {
this.$router.push({
path: "/select-person",
});
break;
}
case "address": {
this.$router.push({
path: "/select-address",
});
break;
}
case "take": {
this.$router.push({
path: "/take-address",
});
break;
}
case "stroke": {
...