forked from AkkomaGang/akkoma-fe
better handling of attachments
This commit is contained in:
parent
d231a45644
commit
031c044297
1 changed files with 15 additions and 4 deletions
|
@ -113,11 +113,22 @@ export const parseUser = (data) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const parseAttachment = (data) => {
|
const parseAttachment = (data) => {
|
||||||
// TODO A little bit messy ATM but works with both APIs
|
const output = {}
|
||||||
return {
|
const masto = !data.hasOwnProperty('oembed')
|
||||||
...data,
|
|
||||||
mimetype: data.mimetype || data.type
|
if (masto) {
|
||||||
|
// Not exactly same...
|
||||||
|
output.mimetype = data.type
|
||||||
|
output.meta = data.meta // not present in BE yet
|
||||||
|
} else {
|
||||||
|
output.mimetype = data.mimetype
|
||||||
|
output.meta = null // missing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output.url = data.url
|
||||||
|
output.description = data.description
|
||||||
|
|
||||||
|
return output
|
||||||
}
|
}
|
||||||
|
|
||||||
export const parseStatus = (data) => {
|
export const parseStatus = (data) => {
|
||||||
|
|
Loading…
Reference in a new issue