0๐
โ
if you are using async
await
you could use the classic try...catch...finally
try {
await fetch(`${this.baseUrl}/wp-json/contact/v1/send`, {
method: 'POST',
body: formData
})
} catch (e) {
console.error(e);
} finally {
console.log('We do cleanup here');
}
Source:stackexchange.com