fix(cockpit/services/api): make sure query params are serialized correctly

In 9097f31c83 we ensured to send query parameters
along with GET requests done by our API service. This resulted in weird behaviour
where query parameters have been attached as `params` in a serialized format of our API requests.

So instead of sending sth. like:

```
/embark-api?token=foo-bar
```

Requests looked like:

```
/embark-api?params=...
```

This has even been patched accordingly on the server like here 043697bddc,
while still being unpatched in other places on the server.

It turns out however, that the reason this `params` parameter appears, is that all of our GET requests,
already send their payload as `params`.

This commit now ensures that GET parameters are sent in the correct format.
This commit is contained in:
Pascal Precht 2018-10-22 10:10:43 +02:00
parent 137fbf6b52
commit 892200a236
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 1 additions and 1 deletions

View File

@ -29,7 +29,7 @@ function request(type, path, params = {}) {
'X-Embark-Cnonce': cnonce 'X-Embark-Cnonce': cnonce
}, },
...(type === 'post' ? { data: params } : {}), ...(type === 'post' ? { data: params } : {}),
...(type === 'get' ? { params } : {}) ...(type === 'get' ? { params: params.params } : {})
} }
return axios(req) return axios(req)