[FEAT] Full function and deployed version
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
import { api } from '$lib/api';
|
||||
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.mjs';
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.js';
|
||||
|
||||
interface Props {
|
||||
pdfUrl: string;
|
||||
@@ -34,9 +34,9 @@
|
||||
loading = true;
|
||||
error = '';
|
||||
try {
|
||||
// Load PDF via axios to include auth token
|
||||
const path = pdfUrl.split('/download/')[1];
|
||||
const response = await api.get(`/download/${path}`, {
|
||||
// pdfUrl already contains the full URL with token
|
||||
// Use it directly with axios
|
||||
const response = await api.get(pdfUrl, {
|
||||
responseType: 'blob'
|
||||
});
|
||||
const blob = new Blob([response.data], { type: 'application/pdf' });
|
||||
|
||||
Reference in New Issue
Block a user