Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. downloadFile () {
  2.       axios.get(`https://localhost/storage/${this.file.name}`, {responseType: 'blob'})
  3.       .then((response) => {
  4.         const url = window.URL.createObjectURL(new Blob([response.data]));
  5.         const link = document.createElement('a');
  6.         link.href = url;
  7.         link.setAttribute('download', this.file.name);
  8.         document.body.appendChild(link);
  9.         link.click();
  10.       })
  11.       .catch((error) => {
  12.           this.dropdownMenuShown = false
  13.           this.showNotification({type: error.response.data.status, message: error.response.data.message})
  14.       })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement