title: Vue.js and Axios slow at fetching pdf
body: <p>I'm having trouble with Vue.js and Axios to fetch pdfs in my Laravel app.</p>
  <p>When ever a user clicks this button:</p>
  <pre><code>&lt;a @click=&quot;fetchData()&quot;&gt;&lt;i class=&quot;fas fa-file-download mouse-pointer&quot;&gt;&lt;/i&gt;&lt;/a&gt;
  </code></pre>
  <p>My fetch method is being called in Vue.js:</p>
  <pre><code>methods: {
          fetchData() {
              axios.get(this.fetchUrl, {responseType: 'arraybuffer'})
                  .then(response =&gt; {
                      let blob = new Blob([response.data], { type: 'application/pdf' })
                      let link = document.createElement('a')
                      link.href = window.URL.createObjectURL(blob)
                      link.stream = 'Faktura nr. ' + this.invoiceId + '.pdf'
                      link.click()
                  })
          }
      },
  </code></pre>
  <p>Which the calls the backend controller for the information from three tables:</p>
  <pre><code>public function download($id)
  {
      return PDF::loadView('app.pdf.invoice', [
  
          'invoice' =&gt; Invoice::find($id),
  
          'student' =&gt; User::find(Auth::user()-&gt;id),
  
          'company' =&gt; Company::find(Auth::user()-&gt;companies_id),
  
      ])-&gt;stream(&quot;'Faktura nr.' $id '.pdf'&quot;);
  
  }
  </code></pre>
  <p>Then the information is sent to the 'fetchData' method, that produces the PDF.</p>
  <p><strong>But it takes almost 2 minutes for the pdf to be created. What can I do to make the call faster?</strong></p>