javascript Exemplo arquivo de client查询前端graphql

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Exemplo arquivo de client查询前端graphql相关的知识,希望对你有一定的参考价值。

import gql from "graphql-tag";

export const GET_JOBS = gql`
  query {
    jobs {
      id
      company
      title
    }
  }
`;

export const GET_JOB = gql`
  query GetJob($jobId: Int!) {
    job: jobs_by_pk(id: $jobId) {
      id
      company
      description
      link_to_apply
    }
  }
`;

export const CREATE_NEW_JOB = gql`
  mutation CreateJob(
    $company: String!
    $title: String!
    $link_to_apply: String!
    $description: String!
  ) {
    insert_jobs(
      objects: {
        company: $company
        title: $title
        link_to_apply: $link_to_apply
        description: $description
      }
    ) {
      returning {
        id
      }
    }
  }
`;

export const DELETE_JOB = gql`
  mutation DeleteJob($jobId: Int!) {
    delete_jobs(where: { id: { _eq: $jobId } }) {
      returning {
        id
      }
    }
  }
`;

以上是关于javascript Exemplo arquivo de client查询前端graphql的主要内容,如果未能解决你的问题,请参考以下文章

javascript Exemplo de promise com async function

html exemplo-complexo.html

html exemplo.html

html exemplo-complexo-2.HTML

csharp Exemplo de uso do SimpleQuery。

json Exemplo de JSON que deve ser gerado pelo programa