formio / vue

Javascript Powered forms and JSON form builder for Vue.js
MIT License
119 stars 65 forks source link

Wrong API call while fetching form resource data #5

Closed airarrazaval closed 6 years ago

airarrazaval commented 6 years ago

When a form has a select component using a resource as values, the formio component uses the following API call:

https://api.form.io/form/<form_id>/submission?<filters>

when in reality it should be:

https://api.form.io/<machine>/form/<form_id>/submission?<filters>

As an example I created the following form. Using Form.io's formview the API call made is correct:

https://api.form.io/mxutsqrnrusfanc/form/5b07f4633fa56bac4d45910e/submission?limit=5&skip=0&sort=data.shortName

but when using vue-formio the call is the following:

https://api.form.io/form/5b07f4633fa56bac4d45910e/submission?sort=data.shortName&limit=100&skip=0

Last, it seems the limit property is not being used in vue-formio and instead the default value limit=100 is being used

airarrazaval commented 6 years ago

I confirm this also happens with the Resource component (example form).

airarrazaval commented 6 years ago

It seems this issue only happens when specifying form instead of src prop.

This fetches the resource without problem:

<formio :src="formUrl" :options="options"></formio>

while this triggers the wrong API call.

<formio :form="form" :options="options"></formio>
YuryRybakSoftensity commented 6 years ago

@airarrazaval It could be fixed, if you provide baseUrl option via options. baseUrl should point to your API handler, for example if you are using Form.io project: { baseUrl: 'https://<project>.form.io' }.