Add fileTypeService
This commit is contained in:
parent
96b4997492
commit
4f8d476a2b
5 changed files with 36 additions and 17 deletions
|
@ -1,4 +1,5 @@
|
|||
import nsfwImage from '../../assets/nsfw.jpg'
|
||||
import fileTypeService from '../../services/file_type/file_type.service.js'
|
||||
|
||||
const Attachment = {
|
||||
props: [
|
||||
|
@ -9,21 +10,7 @@ const Attachment = {
|
|||
data: () => ({ nsfwImage }),
|
||||
computed: {
|
||||
type () {
|
||||
let type = 'unknown'
|
||||
|
||||
if (this.attachment.mimetype.match(/text\/html/)) {
|
||||
type = 'html'
|
||||
}
|
||||
|
||||
if (this.attachment.mimetype.match(/image/)) {
|
||||
type = 'image'
|
||||
}
|
||||
|
||||
if (this.attachment.mimetype.match(/video\/(webm|mp4)/)) {
|
||||
type = 'video'
|
||||
};
|
||||
|
||||
return type
|
||||
return fileTypeService.fileType(this.attachment.mimetype)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue