softwebglobe
5 months ago
12
2
Vue

VueJS run watch error

Posted 5 months ago by softwebglobe

Hello everyone please am working on a project that interacts with a third party API, to make the request to the API I can send custom settings in JSON format. My problem is when i add the settings in vue method i get an error on compile, below is my test code and what i tend to achieve.

            requestName() {
                  "settings":  [
                    {
                      "option1": "value1",
                      "option2": "value2"
                    },
                    {
                      "option3": "value3",
                      "option4": "value4"
                    },
                  ],
                  "locale": "en",
            }

when i run watch i get the following error Syntax Error: SyntaxError: C:\Users...\path-to-\ComponentName.vue: Unexpected token, expected ";"

please help, it gives no error when I do something like below but it gives me invalide settings from the third party API end;

            requestName() {
                let setting =  "settings":  [
                    {
                      "option1": "value1",
                      "option2": "value2"
                    },
                    {
                      "option3": "value3",
                      "option4": "value4"
                    },
                  ],
                  "locale": "en",
            }

Please sign in or create an account to participate in this conversation.