How to display application/pdf response from Rails API to Nuxt frontend

362 Views Asked by At

I'm using Nuxt and Rails to generate PDF.

Chose prawn gem for PDF, and when send proper params, PDF was generates as I intended.

When I use this API from Nuxt throw axios, I want to display application/pdf response to Nuxt frontend

params

{
 name: "myName",
 address1: "Tokyo",
 address2: "Minato-ku"
}

request

const config = {
      responseType: 'blob',
}
const res = await this.$axios.post('/v1/orders', params, config)
=> res.data is like "Blob{size: 12345, type:"application/pdf"}"

I want to display this data as PDF on Nuxt frontend, thanks.

0

There are 0 best solutions below