verdnatura-chat/app/lib/methods/helpers/getFileUrlFromMessage.js

16 lines
319 B
JavaScript
Raw Permalink Normal View History

export default function (message) {
if (/image/.test(message.type)) {
return { image_url: message.url };
}
if (/audio/.test(message.type)) {
return { audio_url: message.url };
}
if (/video/.test(message.type)) {
return { video_url: message.url };
}
return {
title_link: message.url,
type: 'file'
};
}