[Vuejs]-Vue3 graphql composition api dynamic router not working

0👍

I just changed ‘id’ to ‘blogId’ and now it works fine.

 setup(props){
        const {result, error, loading, refetch} = useQuery(gql`
            query getBlogById($blogId: ID!){
                blog(blogId: $blogId){
                    id,
                    title,
                    author,
                    body,
                    dataPublished
                }
            }
        `, () => ({
            blogId: props.blogId,
        }))

        const blog = useResult(result, null, data => data.blog)

        return { blog, error, loading, refetch}
    }

Leave a comment