1 year ago

#282591

test-img

Beginner

Uncaught (in promise) Error: Request failed with status code 504

I send a post request like this:

My code

async sendData(data) {
    const response = await this.$api.request({
      url: `/v2/application/${localStorage.getItem('guildID')}`,
      method: 'post',
      headers: {
        Authorization: `Bearer ${localStorage.getItem('sessionToken')}`,
      },
      data: JSON.stringify(data),
    })
    if (response.status === 200){
      console.log('success')
    }
}

My data

data = {
    "form1": {
      "open": false,
      "auto": "853280935508312105",
      "accepted": {
          "action": "remove",
          "role": "850284484204953600"
      },
      "denied": {
          "action": "add",
          "role": "851511164706095114"
      },
      "questions": [
          "Questions 1",
          {
              "question": "Question MCQ1",
              "options": [],
              "min": 1,
              "max": 1
          },
          "test question",
          "test question1d",
          "Test data"
      ],
      "name": "Test Form1",
      "icon": "πŸ‘",
      "description": "Text text dataπŸ‘12",
      "shuffle": false,
      "wroles": [
          "848107977332359168",
          "848108676334223370",
          "850284484204953600"
      ],
      "broles": [
          "847787637384413256",
          "848107977332359168"
      ],
      "wchans": [
          "847788130224308264"
      ],
      "bchans": [
          "847788130224308264",
          "853280935508312105"
      ],
      "ident": "form1"
    },
    "form2": {
      "name": "Test form2",
      "open": false,
      "description": "test text1\n\n\n\n",
      "icon": null,
      "auto": false,
      "questions": [],
      "denied": false,
      "accepted": false,
      "wroles": [
          "848107977332359168"
      ],
      "broles": [
          "848107977332359168"
      ],
      "wchans": [
          "853280935508312105"
      ],
      "bchans": [
          "847788130224308264",
          "848101949576052768"
      ],
      "shuffle": false,
      "ident": "form2"
    },
    "form3": {
      "questions": [],
      "open": false,
      "auto": false,
      "accepted": false,
      "denied": false,
      "name": "Test From3",
      "description": null,
      "icon": null,
      "shuffle": false,
      "wroles": [
          "937941242174652427"
      ],
      "broles": [
          "848107977332359168",
          "848108676334223370",
          "862283463885455370"
      ],
      "wchans": [
          "895709844219240490"
      ],
      "bchans": [
          "853280935508312105"
      ],
      "ident": "form3"
    }
}

Saved data in DB but got 504 error.

but if "data" is simple string(ex: 'prefix').

vue.js

nuxt.js

http-status-code-504

0 Answers

Your Answer

Accepted video resources