await useFetch('/api/articles/createArticle', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: form.value,
onResponse({response}) {
console.log(response);
if (response.status === 200) {
toast.add({
id: "success",
color: "green",
icon: "i-heroicons-check-circle",
title: t('admin.sales.success'),
description: t('admin.sales.the-yacht-created'),
});
isOpenCreate.value = false;
console.log('refresh');
resetForm();
refresh();
} else {
toast.add({
id: "error",
color: "red",
icon: "i-heroicons-x-circle",
title: t('admin.sales.an-error-occurred'),
description: t('admin.sales.please-try-again') + response._data.message,
});
}
},
});
await useFetch('/api/articles/createArticle', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: form.value,
onResponse({response}) {
console.log(response);
if (response.status === 200) {
toast.add({
id: "success",
color: "green",
icon: "i-heroicons-check-circle",
title: t('admin.sales.success'),
description: t('admin.sales.the-yacht-created'),
});
isOpenCreate.value = false;
console.log('refresh');
resetForm();
refresh();
} else {
toast.add({
id: "error",
color: "red",
icon: "i-heroicons-x-circle",
title: t('admin.sales.an-error-occurred'),
description: t('admin.sales.please-try-again') + response._data.message,
});
}
},
});