mirror of https://github.com/embarklabs/embark.git
fix(cockpit/services/api): make sure query params are serialized correctly
In9097f31c83
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 here043697bddc
, 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:
parent
137fbf6b52
commit
892200a236
|
@ -29,7 +29,7 @@ function request(type, path, params = {}) {
|
|||
'X-Embark-Cnonce': cnonce
|
||||
},
|
||||
...(type === 'post' ? { data: params } : {}),
|
||||
...(type === 'get' ? { params } : {})
|
||||
...(type === 'get' ? { params: params.params } : {})
|
||||
}
|
||||
|
||||
return axios(req)
|
||||
|
|
Loading…
Reference in New Issue