Skip to content
Snippets Groups Projects
Commit 5786e8df authored by vaartis's avatar vaartis
Browse files

Move emoji address construction to a function

parent 349dcbfc
No related branches found
No related tags found
No related merge requests found
Pipeline #17360 passed
......@@ -139,4 +139,9 @@ export async function updatePackFile(host, token, args) {
})
}
export function addressOfEmojiInPack(host, packName, name) {
// This needs http because hackney on the BE does not understand URLs with just "//"
return `http://${baseName(host)}/emoji/${packName}/${name}`
}
const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {}
......@@ -45,7 +45,7 @@
<el-col :span="2">
<img
:src="`//${host}/emoji/${packName}/${file}`"
:src="addressOfEmojiInPack(host, packName, file)"
class="emoji-preview-img">
</el-col>
</el-row>
......@@ -63,6 +63,9 @@
</style>
<script>
import { addressOfEmojiInPack } from '@/api/emoji_packs'
export default {
props: {
host: {
......@@ -155,8 +158,7 @@ export default {
packName: this.copyToLocalPackName,
shortcode: this.copyToShortcode.trim() !== '' ? this.copyToShortcode.trim() : this.name,
fileName: this.copyToFilename.trim() !== '' ? this.copyToFilename.trim() : this.file,
// This needs http because hackney on the BE does not understand URLs with just "//"
file: `http://${this.host}/emoji/${this.packName}/${this.file}`
file: this.addressOfEmojiInPack(this.host, this.packName, this.file)
}).then(() => {
this.copyToLocalPackName = null
this.copyToLocalVisible = false
......@@ -165,7 +167,9 @@ export default {
this.$store.dispatch('ReloadEmoji')
})
}
},
addressOfEmojiInPack
}
}
</script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment