I have a delete function that takes an ID parameter, and I need it to work every time except when id === 1. How can this be done?
const handleDeleteEmail = (emailId: number) => {
dispatch(deleteEmailTemplate(emailId));
EmailTemplatesApi.deleteEmailTemplate(emailId);
};
You can check that the condition is met using an if statement as follow:
const handleDeleteEmail = (emailId: number) => {
if(emailId !== 1) {
dispatch(deleteEmailTemplate(emailId));
EmailTemplatesApi.deleteEmailTemplate(emailId);
}
};