Hello, thanks for module!
I have a question: is there a way to validate apollo response before render?
I have a page /pages/users/_username.vue and I want to render proper Not Found page along with 404 status code if username is not found (when graphql returns null).
Currently I have to something like this:
<template>
<div>
<div v-if="user">
<h1>{{user.fullName}}</h1>
</div>
<div v-else >
User is not found :(
</div>
</div>
</template>
It'd be great to handle graphql response in the same way nuxt's validate hook works.
@minibikini how about redirect the user with
apollo:{
user:{
query:UserQueryGql,
result({data}){
if(!data){
this.$router.push('/404') // redirect if data not found
}
}
}
}
I will close this issue due to inactivity. Personally I think its part of vue-apollo rather than this repo to provide guidance on your issue. Maybe you can even make use of Nuxt validate functionality