Intevel/nuxt-directus

Saves the API response to a file. csv, json, xml, yaml.

hermesalvesbr opened this issue · 3 comments

 ?export=csv
?export=json
?export=xml
?export=yaml

I need to make an export button that picks up the directus export options, is there any way to do this using your api? Because the collections are private and I would like to use the current session.

Thanks for your module!

  async exportData() {
        try {
            const data = await this.directus.getItems({
                collection: 'edicao',
                params: {
                    export: 'csv',
                    sort: '-date_created',
                    limit: 10,
                } as ExtendedDirectusQueryParams,
            })
            // console.log(data)
            return data
        } catch (e: any) {
            throw new Error('Connection failed', e.message)
        }
    }

This function, return undefined

Currently this doesn't work, I can add this feature in the next days.

Thanks