I have a few lines of code which seems pretty simple, but just doing something unexpected, appreciate if you could eyeball it for me and give me a hint.
there are two console.log in the code and the output of them are in the picture attached, the first log shows they are holding some values, and the second suggests that they don't ( assignment doesn't work), just can't see how those lines in between could affect.
notes: some commented lines in between have been removed for clearity.
const { password, confirmPassword, role, position, ...rest } = this.state.data
console.log(role.value, position.value)
let dataToSave
if (this.state.isPasswordChanged) {
dataToSave = { password, roleID: role.value, positionId: position.value, ...rest
}
else {
dataToSave = { roleID: role.value, positionId: position.value, ...rest }
}
console.log(dataToSave)