Nuxt/test/fixtures/basic/pages/validate-async.vue
2018-08-25 22:24:16 +04:30

22 lines
424 B
Vue

<template>
<h1>I am valid</h1>
</template>
<script>
export default {
validate({ query }) {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (query.error) {
const err = new Error('Custom Error')
err.statusCode = parseInt(query.error) || 500
reject(err)
} else {
resolve(Boolean(query.valid))
}
}, 500)
})
}
}
</script>