diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-01-04 14:34:17 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-01-04 14:34:17 +0100 |
commit | 6af71d96078fe5abd6d76cda1b5d25bc5eba9330 (patch) | |
tree | 999eeae14373e73040454a92de6f51919a7441d5 | |
parent | 01aa0bfae50dbbf688943f9b30acc08a0d1fa1dd (diff) |
Fix group vcard download
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
-rw-r--r-- | package-lock.json | 50 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/views/Contacts.vue | 12 |
3 files changed, 23 insertions, 40 deletions
diff --git a/package-lock.json b/package-lock.json index 13bcc84f..c691b76e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1960,8 +1960,8 @@ "dev": true }, "cdav-library": { - "version": "github:nextcloud/cdav-library#906998275c39716601db4348f7f7371d2f154848", - "from": "github:nextcloud/cdav-library#906998275c39716601db4348f7f7371d2f154848", + "version": "github:nextcloud/cdav-library#0d5be948bbe5682ac350f8534c4459885e5eb25d", + "from": "github:nextcloud/cdav-library", "requires": { "@babel/polyfill": "^7.2.5" }, @@ -2886,6 +2886,11 @@ "is-obj": "^1.0.0" } }, + "downloadjs": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/downloadjs/-/downloadjs-1.4.7.tgz", + "integrity": "sha1-9p+W+UDg0FU9rCkROYZaPNAQHjw=" + }, "duplexify": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.1.tgz", @@ -3998,8 +4003,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -4020,14 +4024,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4042,20 +4044,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -4172,8 +4171,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -4185,7 +4183,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4200,7 +4197,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4208,14 +4204,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4234,7 +4228,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -4315,8 +4308,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -4328,7 +4320,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -4414,8 +4405,7 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -4451,7 +4441,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4471,7 +4460,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4515,14 +4503,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, diff --git a/package.json b/package.json index 46ffdf30..2b18d8b6 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "dependencies": { "cdav-library": "github:nextcloud/cdav-library", "debounce": "^1.2.0", + "downloadjs": "^1.4.7", "ical.js": "^1.3.0", "moment": "^2.23.0", "nextcloud-server": "^0.15.9", diff --git a/src/views/Contacts.vue b/src/views/Contacts.vue index 2d1493a8..c7c80a42 100644 --- a/src/views/Contacts.vue +++ b/src/views/Contacts.vue @@ -52,6 +52,7 @@ <script> import moment from 'moment' +import download from 'downloadjs' import SettingsSection from 'Components/SettingsSection' import ContactsList from 'Components/ContactsList' @@ -345,17 +346,12 @@ export default { /** * Download vcard promise as vcard file * - * @param {Object} vcardPromise object to be downloaded + * @param {Promise} vcardPromise the full vcf file promise */ - downloadVcardPromise(vcardPromise) { + async downloadVcardPromise(vcardPromise) { vcardPromise.then(response => { - const blob = new Blob([response.data], { type: 'text/vcard' }) - const url = URL.createObjectURL(blob) - const link = document.createElement('a') const filename = moment().format('YYYY-MM-DD_HH-mm') + '_' + response.groupName + '.vcf' - link.href = url - link.download = filename - link.click() + download(response.data, filename, 'text/vcard') }) }, |