Skip to content
Snippets Groups Projects
Commit a2072165 authored by Angelina Filippova's avatar Angelina Filippova
Browse files

Implement multipart request for uploading emojis

parent 32432e1f
No related branches found
No related tags found
1 merge request!112Update emoji API
Pipeline #24121 passed
......@@ -3,15 +3,21 @@ import { getToken } from '@/utils/auth'
import { baseName } from './utils'
export async function addNewEmojiFile(packName, file, shortcode, filename, host, token) {
const data = new FormData()
if (filename.trim() !== '') {
data.set('filename', filename)
}
if (shortcode.trim() !== '') {
data.set('shortcode', shortcode)
}
data.set('file', file)
return await request({
baseURL: baseName(host),
url: `/api/pleroma/emoji/packs/${packName}/files`,
method: 'post',
headers: authHeaders(token),
data: {
file,
shortcode: shortcode.trim() !== '' ? shortcode : null,
filename: filename.trim() !== '' ? filename : null }
data
})
}
......
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