Import the GraphQL file in nuxt.js.
P粉754473468
P粉754473468 2023-07-28 10:59:10
0
1
462

So I'm importing the schema generated by postgraphile, but it's not loading correctly.

This is the type of output:


definitions: Array(44) [ {…}, {…}, {…}, … ] kind: "Document" loc: Object { start: 0, end: 26188, source: {…} }

I have tried various code variations to load my query allUsers.


P粉754473468
P粉754473468

reply all (1)
P粉807471604

The valueOf method is not suitable for this purpose. GraphQL schema documents do not have direct access to their queries, mutations, or subscriptions via key-value access methods. ,

First, make sure you have installed the graphql-tag package in your project:

npm install graphql-ta

Define your query in schema.gql:


query AllUsers { allUsers { nodes { id name # other fields... } } }

Import and use AllUsers query in the component:

Hope it’s useful

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!