@
@
@nonconformiste2022-02-15 20:15:28
JavaScript
@nonconformiste, 2022-02-15 20:15:28

How to fix 405 request error after deploy to vercel?

I set up the environment, added token variables and api endpoint, but on the backdoor site, when sending a request, it returns 405b, I found on the Internet that you just need to send a post request, but I don’t know how to change my code (I did it using the examples in the documentation), so for it to work.

//main.js
const graphcmsEndpoint = process.env.VUE_APP_GRAPHCMS_ENDPOINT;
const graphcmsToken = String(process.env.VUE_APP_GRAPHCMS_TOKEN);
const headers = { authorization: `Bearer ${graphcmsToken}` };
const graphqlClient = new GraphQLClient(graphcmsEndpoint, { headers });

Vue.mixin({
  beforeCreate() {
    this.$graphcms = graphqlClient;
  },
});


//Home.vue
const data = await this.$graphcms.request(
        gql`
          mutation{
            createTicket(data: {name:"${name}", date:"${date}", nationality:"${nationality}", country:"${country}", zip:"${zip}", electricTariff:"${tariff}", regularyUse:"${count_regulary}", usePerYear:"${count_year}"}){
              id
              name
              date
              nationality
              country
              zip
              electricTariff
              regularyUse
              usePerYear
            }
          }
        `
      )

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question