Use URLSearchParams

This commit is contained in:
Adria Navarro 2024-07-22 14:34:58 +02:00
parent d6e268d475
commit cec24fb40d
1 changed files with 4 additions and 3 deletions

View File

@ -27,12 +27,13 @@ export const buildAutomationEndpoints = API => ({
* Gets a list of all automations.
*/
getAutomations: async ({ enrich }) => {
let url = "/api/automations?"
const params = new URLSearchParams()
if (enrich) {
url += "enrich=true"
params.set("enrich", true)
}
return await API.get({
url,
url: `/api/automations?${params.toString()}`,
})
},