Use the remote pack listing endpoint

This commit is contained in:
Ekaterina Vaartis 2019-09-24 19:38:35 +03:00
parent f2c2a95989
commit 10d3f3f0a0
2 changed files with 15 additions and 2 deletions

View file

@ -48,6 +48,16 @@ export async function listPacks(host) {
})
}
export async function listRemotePacks(host, token, instance) {
return await request({
baseURL: baseName(host),
url: `/api/pleroma/emoji/packs/list_from`,
method: 'post',
headers: authHeaders(token),
data: { instance_address: instance }
})
}
export async function downloadFrom(host, instance_address, pack_name, as, token) {
if (as.trim() === '') {
as = null

View file

@ -1,4 +1,6 @@
import { listPacks,
import {
listPacks,
listRemotePacks,
downloadFrom,
reloadEmoji,
createPack,
@ -47,7 +49,8 @@ const packs = {
commit('SET_LOCAL_PACKS', data)
},
async SetRemoteEmojiPacks({ commit, getters, state }, { remoteInstance }) {
const { data } = await listPacks(remoteInstance)
const { data } = await listRemotePacks(getters.authHost, getters.token, remoteInstance)
commit('SET_REMOTE_PACKS', data)
},
async DownloadFrom({ commit, getters, state }, { instanceAddress, packName, as }) {