Fix the address used when listing remote packs

This commit is contained in:
Angelina Filippova 2020-02-19 20:09:11 +03:00
parent 38c1842768
commit 8abf2758e1
2 changed files with 9 additions and 4 deletions

View file

@ -16,24 +16,25 @@ import Vue from 'vue'
const packs = { const packs = {
state: { state: {
localPacks: {}, localPacks: {},
remoteInstance: '',
remotePacks: {} remotePacks: {}
}, },
mutations: { mutations: {
SET_LOCAL_PACKS: (state, packs) => { SET_LOCAL_PACKS: (state, packs) => {
state.localPacks = packs state.localPacks = packs
}, },
SET_REMOTE_INSTANCE: (state, name) => {
state.remoteInstance = name
},
SET_REMOTE_PACKS: (state, packs) => { SET_REMOTE_PACKS: (state, packs) => {
state.remotePacks = packs state.remotePacks = packs
}, },
UPDATE_LOCAL_PACK_VAL: (state, { name, key, value }) => { UPDATE_LOCAL_PACK_VAL: (state, { name, key, value }) => {
Vue.set(state.localPacks[name]['pack'], key, value) Vue.set(state.localPacks[name]['pack'], key, value)
}, },
UPDATE_LOCAL_PACK_PACK: (state, { name, pack }) => { UPDATE_LOCAL_PACK_PACK: (state, { name, pack }) => {
state.localPacks[name]['pack'] = pack state.localPacks[name]['pack'] = pack
}, },
UPDATE_LOCAL_PACK_FILES: (state, { name, files }) => { UPDATE_LOCAL_PACK_FILES: (state, { name, files }) => {
// Use vue.set in case "files" was null // Use vue.set in case "files" was null
Vue.set( Vue.set(
@ -105,6 +106,7 @@ const packs = {
async SetRemoteEmojiPacks({ commit, getters }, { remoteInstance }) { async SetRemoteEmojiPacks({ commit, getters }, { remoteInstance }) {
const { data } = await listRemotePacks(getters.authHost, getters.token, remoteInstance) const { data } = await listRemotePacks(getters.authHost, getters.token, remoteInstance)
commit('SET_REMOTE_INSTANCE', remoteInstance)
commit('SET_REMOTE_PACKS', data) commit('SET_REMOTE_PACKS', data)
}, },
async UpdateAndSavePackFile({ commit, getters }, args) { async UpdateAndSavePackFile({ commit, getters }, args) {

View file

@ -14,7 +14,7 @@
<div v-if="!isLocal" class="emoji-container"> <div v-if="!isLocal" class="emoji-container">
<img <img
:src="addressOfEmojiInPack(host, packName, file)" :src="addressOfEmojiInPack(remoteInstance, packName, file)"
class="emoji-preview-img"> class="emoji-preview-img">
<el-input :value="emojiName" :placeholder="$t('emoji.shortcode')" class="emoji-info"/> <el-input :value="emojiName" :placeholder="$t('emoji.shortcode')" class="emoji-info"/>
<el-input :value="emojiFile" :placeholder="$t('emoji.file')" class="emoji-info"/> <el-input :value="emojiFile" :placeholder="$t('emoji.file')" class="emoji-info"/>
@ -95,6 +95,9 @@ export default {
}, },
localPacks() { localPacks() {
return this.$store.state.emojiPacks.localPacks return this.$store.state.emojiPacks.localPacks
},
remoteInstance() {
return this.$store.state.emojiPacks.remoteInstance
} }
}, },
methods: { methods: {