Fix link for downloading emoji pack to instance

This commit is contained in:
Angelina Filippova 2020-03-25 02:20:56 +03:00
parent 1bcf33abdc
commit 05abaf1916

View file

@ -92,7 +92,7 @@
</p> </p>
<div class="download-shared-pack"> <div class="download-shared-pack">
<el-input v-model="downloadSharedAs" :placeholder=" $t('emoji.downloadAsOptional')"/> <el-input v-model="downloadSharedAs" :placeholder=" $t('emoji.downloadAsOptional')"/>
<el-button type="primary" class="download-shared-pack-button" @click="downloadFromInstance"> <el-button type="primary" class="download-shared-pack-button" @click="downloadFromInstance(pack.pack['homepage'])">
{{ isDesktop ? $t('emoji.downloadSharedPack') : $t('emoji.downloadSharedPackMobile') }} {{ isDesktop ? $t('emoji.downloadSharedPack') : $t('emoji.downloadSharedPackMobile') }}
</el-button> </el-button>
</div> </div>
@ -209,10 +209,11 @@ export default {
} }
}, },
methods: { methods: {
downloadFromInstance() { downloadFromInstance(url) {
const instanceAddress = `${new URL(url).protocol}//${new URL(url).hostname}`
this.$store.dispatch( this.$store.dispatch(
'DownloadFrom', 'DownloadFrom',
{ instanceAddress: this.host, packName: this.name, as: this.downloadSharedAs } { instanceAddress, packName: this.name, as: this.downloadSharedAs }
).then(() => this.$store.dispatch('ReloadEmoji')) ).then(() => this.$store.dispatch('ReloadEmoji'))
.then(() => this.$store.dispatch('SetLocalEmojiPacks')) .then(() => this.$store.dispatch('SetLocalEmojiPacks'))
}, },