| | |
| | | import { Base64 } from 'js-base64'; |
| | | import { $fytz } from '../index'; |
| | | |
| | | /** |
| | |
| | | return $fytz |
| | | .get(`credit/ecCode/download?userId=${userId}`, { responseType: 'blob' }) |
| | | .then((res) => { |
| | | const url = window.URL.createObjectURL(new Blob([res.data])); |
| | | const name = Base64.decode(res.headers.get('fileName')); |
| | | const url = window.URL.createObjectURL(res.data); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.setAttribute('download', 'creditCode.png'); |
| | | link.setAttribute('download', name); |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |