From 9137362dc719e481c37b88a827d7a029c6d01e11 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Fri, 26 Jun 2020 00:55:43 +0300 Subject: [PATCH] Fix downloading remote packs --- src/api/emojiPacks.js | 10 ++++------ src/store/modules/emojiPacks.js | 2 +- src/views/emojiPacks/components/RemoteEmojiPack.vue | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/api/emojiPacks.js b/src/api/emojiPacks.js index 4edb722b..b2f980a1 100644 --- a/src/api/emojiPacks.js +++ b/src/api/emojiPacks.js @@ -52,17 +52,15 @@ export async function deletePack(host, token, packName) { }) } -export async function downloadFrom(host, instance, packName, as, token) { - if (as.trim() === '') { - as = null - } - +export async function downloadFrom(instanceAddress, packName, as, host, token) { return await request({ baseURL: baseName(host), url: '/api/pleroma/emoji/packs/download', method: 'post', headers: authHeaders(token), - data: { url: baseName(instance), name: packName, as }, + data: as.trim() === '' + ? { url: baseName(instanceAddress), name: packName } + : { url: baseName(instanceAddress), name: packName, as }, timeout: 0 }) } diff --git a/src/store/modules/emojiPacks.js b/src/store/modules/emojiPacks.js index 1ada57b9..6874ed9c 100644 --- a/src/store/modules/emojiPacks.js +++ b/src/store/modules/emojiPacks.js @@ -116,7 +116,7 @@ const emojiPacks = { await deletePack(getters.authHost, getters.token, name) }, async DownloadFrom({ getters }, { instanceAddress, packName, as }) { - const result = await downloadFrom(getters.authHost, instanceAddress, packName, as, getters.token) + const result = await downloadFrom(instanceAddress, packName, as, getters.authHost, getters.token) if (result.data === 'ok') { Message({ diff --git a/src/views/emojiPacks/components/RemoteEmojiPack.vue b/src/views/emojiPacks/components/RemoteEmojiPack.vue index 3dcca6c0..a3ebe017 100644 --- a/src/views/emojiPacks/components/RemoteEmojiPack.vue +++ b/src/views/emojiPacks/components/RemoteEmojiPack.vue @@ -24,7 +24,7 @@