aboutsummaryrefslogtreecommitdiff
path: root/src/components/attachment/attachment.js
diff options
context:
space:
mode:
authordtluna <dtluna@openmailbox.org>2016-11-25 20:21:25 +0300
committerdtluna <dtluna@openmailbox.org>2016-11-25 20:21:25 +0300
commit4f8d476a2b5ff9bb75f8300665e2c18aa96fecfd (patch)
tree96141e9f35c4597f30e843e6874f9867b49a420e /src/components/attachment/attachment.js
parent96b4997492a5d784bc318524ed86cc414ca74720 (diff)
Add fileTypeService
Diffstat (limited to 'src/components/attachment/attachment.js')
-rw-r--r--src/components/attachment/attachment.js17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js
index 99958589..fa43c12f 100644
--- a/src/components/attachment/attachment.js
+++ b/src/components/attachment/attachment.js
@@ -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: {