mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-16 02:44:51 +00:00
20 lines
421 B
Vue
20 lines
421 B
Vue
<template>
|
|
<div>
|
|
{{ state.attr }}
|
|
{{ data.something }}
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
const { data, error } = await useAsyncData(() => {
|
|
throw new Error('some error')
|
|
}, { server: true })
|
|
|
|
if (error.value) {
|
|
useCookie('some-error').value = 'was set'
|
|
throw createError({ statusCode: 422, fatal: true, statusMessage: 'This is a custom error' })
|
|
}
|
|
|
|
const state = ref({ attr: 'Hello World' })
|
|
</script>
|