diff --git a/src/routes/_actions/emoji.js b/src/routes/_actions/emoji.js index 373507e1..81888f4a 100644 --- a/src/routes/_actions/emoji.js +++ b/src/routes/_actions/emoji.js @@ -9,7 +9,11 @@ import isEqual from 'lodash-es/isEqual' async function syncEmojiForInstance (instanceName, syncMethod) { await syncMethod( - () => getCustomEmoji(instanceName), + () => { + const { loggedInInstances } = store.get() + const accessToken = loggedInInstances[instanceName].access_token + return getCustomEmoji(instanceName, accessToken) + }, () => database.getCustomEmoji(instanceName), emoji => database.setCustomEmoji(instanceName, emoji), emoji => { diff --git a/src/routes/_api/emoji.js b/src/routes/_api/emoji.js index 1c210db4..e0a30089 100644 --- a/src/routes/_api/emoji.js +++ b/src/routes/_api/emoji.js @@ -1,7 +1,7 @@ -import { basename } from './utils' +import { auth, basename } from './utils' import { DEFAULT_TIMEOUT, get } from '../_utils/ajax' -export async function getCustomEmoji (instanceName) { +export function getCustomEmoji (instanceName, accessToken) { const url = `${basename(instanceName)}/api/v1/custom_emojis` - return get(url, null, { timeout: DEFAULT_TIMEOUT }) + return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT }) }