import proxy from libs http-common import linkPreviewURL from services

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import proxy from '../../../libs/http-common'
import { linkPreviewURL } from '../../../services/api'
const getDefaultCommonSharingVideo = () => {
return {
name: '',
title: '',
mime_type: '',
link: '',
duration: '00:00:00.00',
size: 0,
thumbnail: '',
thumbnails_suggestions: [],
converted_video: '',
converted_link: '',
converted_mime_type: '',
converted_size: 0
}
}
const getDefaultCommonSelection = () => {
return {
message: '',
title: '',
description: '',
image: [],
video: getDefaultCommonSharingVideo(),
url: '',
image_suggestions: [],
mentions: []
}
}
const getDefaultCommonPreview = () => {
return {
facebook_url: '',
twitter_url: '',
linkedin_url: '',
pinterest_url: '',
tumblr_url: '',
instagram_url: '',
source_url: '',
website: ''
}
}
export default{
state: {
status: false,
preview_cancelled: false,
selection: { ...getDefaultCommonSelection(), ...getDefaultCommonPreview() }
},
getters: {
getCommonBox: state => {
return state
}
},
actions: {
},
mutations: {
SET_COMMON_BOX_MESSAGE (state, value) {
state.selection.message = value
},
SET_COMMON_BOX_PREVIEW (state, preview) {
if (preview.title) {
state.selection = Object.assign(state.selection, preview)
} else {
state.selection = Object.assign(state.selection, getDefaultCommonPreview())
}
console.log('CommonBoxPreview Selection', state.selection)
},
SET_COMMON_BOX_PREVIEW_CANCELLED (state, value) {
state.preview_cancelled = value
state.selection = Object.assign(state.selection, { ...getDefaultCommonPreview(), ...{ title: '', description: '', url: '' } })
},
SET_COMMON_BOX_PREVIEW_IMAGE (state, value) {
state.selection.image = value
},
SET_COMMON_BOX_URL (state, value) {
state.selection.url = value
}
}
}