parent
456dac73b5
commit
2585b55479
|
@ -9,7 +9,11 @@ import isEqual from 'lodash-es/isEqual'
|
||||||
|
|
||||||
async function syncEmojiForInstance (instanceName, syncMethod) {
|
async function syncEmojiForInstance (instanceName, syncMethod) {
|
||||||
await syncMethod(
|
await syncMethod(
|
||||||
() => getCustomEmoji(instanceName),
|
() => {
|
||||||
|
const { loggedInInstances } = store.get()
|
||||||
|
const accessToken = loggedInInstances[instanceName].access_token
|
||||||
|
return getCustomEmoji(instanceName, accessToken)
|
||||||
|
},
|
||||||
() => database.getCustomEmoji(instanceName),
|
() => database.getCustomEmoji(instanceName),
|
||||||
emoji => database.setCustomEmoji(instanceName, emoji),
|
emoji => database.setCustomEmoji(instanceName, emoji),
|
||||||
emoji => {
|
emoji => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { basename } from './utils'
|
import { auth, basename } from './utils'
|
||||||
import { DEFAULT_TIMEOUT, get } from '../_utils/ajax'
|
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`
|
const url = `${basename(instanceName)}/api/v1/custom_emojis`
|
||||||
return get(url, null, { timeout: DEFAULT_TIMEOUT })
|
return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue