This repository has been archived by the owner on Nov 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
/
app.js
executable file
·92 lines (77 loc) · 2.93 KB
/
app.js
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
86
87
88
89
90
91
92
import Vue from 'vue'
import App from './App.vue'
import { createStore } from './store'
import { createRouter } from './router'
import { sync } from 'vuex-router-sync'
import titleMixin from './util/title'
import * as filters from './util/filters'
import BootstrapVue from 'bootstrap-vue'
import dateFormat from 'date-fns/format'
import Raven from 'raven-js';
import RavenVue from 'raven-js/plugins/vue';
import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { faFileAlt, faFileWord, faExclamationTriangle, faTimes, faMicrophone, faDesktop, faExternalLinkAlt, faSave, faTrashAlt, faCog, faCheckCircle, faSpinner, faChevronRight, faMinusCircle, faPlusCircle, faArrowLeft, faFlask } from '@fortawesome/free-solid-svg-icons'
import { faThumbsUp } from '@fortawesome/free-regular-svg-icons'
import { faApple, faWindows, faAndroid, faChrome } from '@fortawesome/fontawesome-free-brands'
library.add(faFileAlt, faThumbsUp, faFileWord, faExclamationTriangle, faTimes, faMicrophone, faDesktop, faApple, faWindows, faAndroid, faExternalLinkAlt, faSave, faTrashAlt, faCog, faCheckCircle, faSpinner, faChrome,faChevronRight, faMinusCircle, faPlusCircle, faArrowLeft, faFlask)
Vue.component('fa', {
functional: true,
props: FontAwesomeIcon.props,
render (h, context) {
if (context.parent._isMounted) {
return h(FontAwesomeIcon, context)
} else {
context.parent.$once('hook:mounted', () => {
context.parent.$forceUpdate()
})
}
}
})
// Raven
// .config('REMOVED')
// .addPlugin(RavenVue, Vue)
// .install();
const dateFormatPlugin = {
install () {
Vue.helpers = {dateFormat}
Vue.prototype.$helpers = {dateFormat}
}
};
Vue.use(dateFormatPlugin);
Vue.use(BootstrapVue);
Vue.directive('autofocus', {
// When the bound element is inserted into the DOM...
inserted: function (el) {
// Focus the element
el.focus()
}
})
// mixin for handling title
Vue.mixin(titleMixin)
// register global utility filters.
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
// Expose a factory function that creates a fresh set of store, router,
// app instances on each call (which is called for each SSR request)
export function createApp () {
// create store and router instances
const store = createStore()
const router = createRouter()
// sync the router with the vuex store.
// this registers `store.state.route`
sync(store, router)
// create the app instance.
// here we inject the router, store and ssr context to all child components,
// making them available everywhere as `this.$router` and `this.$store`.
const app = new Vue({
router,
store,
render: h => h(App)
})
// expose the app, the router and the store.
// note we are not mounting the app here, since bootstrapping will be
// different depending on whether we are in a browser or on the server.
return { app, router, store }
}