When checking the backend using Vuex to conditionally render error messages, I utilize the getByTitle function below:
const getByTitle = (memberTitle) => {
return state.errors.find(e => e.meta.memberTitle === memberTitle)
?.content.error.title;
}
For this particular component, I need to pass 2 strings as arguments, as there are 2 options to consider.
getNumber() {
return this.getErrorByMemberId('B2Bvr' || 'Cvr' || undefined);
},
However, when the correct value in the backend is 'Cvr', the error message does not display because 'B2Bvr' comes first in the parameter sequence. By rearranging the arguments to prioritize 'Cvr' (as seen in the snippet below), the error message displays correctly.
getNumber() {
return this.getErrorByMemberId('Cvr' || 'B2Bvr' || undefined);
},
Why does it prioritize the first argument over the second? And what is the proper way to use Logical OR operators within parameters?