Cleaned up most vanilla try catches

This commit is contained in:
Alexis
2025-04-18 17:11:45 +02:00
parent 9b4556245e
commit 00224417be
14 changed files with 163 additions and 177 deletions

View File

@@ -34,16 +34,20 @@ const validSkeleton = computed(() => validSkeletonGeneral.value && validSkeleton
const isUpdatingCalendar = ref<boolean>(false)
async function handleSubmit() {
try {
isUpdatingCalendar.value = true
await $fetch(`/api/calendars/${calendarSkeleton.value.id}`, { method: "PATCH", body: { ...calendarSkeleton.value, worldId: props.world?.id } })
isUpdatingCalendar.value = true
emit("on-close")
} catch (err) {
console.log(err)
} finally {
const { error } = await tryCatch(
$fetch(`/api/calendars/${calendarSkeleton.value.id}`, { method: "PATCH", body: { ...calendarSkeleton.value, worldId: props.world?.id } })
)
if (error) {
console.log(error.message)
isUpdatingCalendar.value = false
return
}
emit("on-close")
isUpdatingCalendar.value = false
}
/**