1👍
✅
You could use the conditional operator:
updateTicketCustomer ({commit, state}, selectedCustomer) {
axios.patch('/tickets/' + state.currentTicket.id, {
customer_id: selectedCustomer !== null ? selectedCustomer.id : null
})
.then((response) => {
commit('UPDATE_TICKET_CUSTOMER', selectedCustomer)
});
}
The syntax is, basically:
<condition> ? <returned if true> : <returned if false>
Source:stackexchange.com