Hi I'm bothering with display data in logs by console.log()
. I'm using redux toolkit with react native and I'm always getting an undefined
in response.So this is where I made my query:
downloadInvoice: builder.query< { blob: string }, { invoiceId?: string; variant: 'original' | 'duplicate'; }>({ query: params => ({ url: `v1/company_invoices/${params.invoiceId}/download`, method: 'GET', params: { variant: params.variant } }) }),
As you can see I only want one param in payload. It's just a very long string (blob I think), without any name before it.
In web developer tools I see this payload and status code 200.
I invoke this query like this:
[...]const [downloadInvoice, result] = useLazyDownloadInvoiceQuery();[...]<Button title={'TestButton'} onPress={() => { downloadInvoice({ invoiceId: invoiceId, variant: 'original' }), console.log(result?.data); console.log(invoiceId); }}></Button>
I've never had problems with displaying fetched data, so I don't really know where is a problem.
EDIT:The same problem occurs when I use useMutation
and useQuery