frontend/src/main.js

67 lines
1.7 KiB
JavaScript
Raw Normal View History

2021-04-09 16:01:28 +10:00
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import Buefy, { Snackbar } from "buefy";
import axios from "axios";
import VueAxios from "vue-axios";
import i18n from "./i18n";
import moment from "moment";
import VMdEditor from "@kangc/v-md-editor";
import "@kangc/v-md-editor/lib/style/base-editor.css";
import enUS from "@kangc/v-md-editor/lib/lang/en-US";
import createHljsTheme from "@kangc/v-md-editor/lib/theme/hljs";
import json from "highlight.js/lib/languages/json";
2021-02-02 23:44:45 +11:00
const hljsTheme = createHljsTheme();
2021-04-09 16:01:28 +10:00
import io from "socket.io-client"
2021-02-02 23:44:45 +11:00
import VueSocketIO from "vue-socket.io";
2021-02-04 18:23:11 +11:00
import NProgress from "vue-nprogress";
2021-04-09 16:01:28 +10:00
Vue.use(NProgress);
const nprogress = new NProgress();
2021-02-02 23:44:45 +11:00
Vue.use(
new VueSocketIO({
2021-04-09 16:01:28 +10:00
debug: true,
connection: io(process.env.VUE_APP_GATEWAYENDPOINT), // options object is Optional
2021-02-02 23:44:45 +11:00
})
);
2021-04-09 16:01:28 +10:00
Vue.use(VMdEditor);
Vue.use(VueAxios, axios);
Vue.use(Buefy);
2021-02-02 23:44:45 +11:00
2021-04-09 16:01:28 +10:00
Vue.config.productionTip = false;
Vue.prototype.$snackbar = Snackbar;
2021-04-09 19:59:33 +10:00
axios.defaults.headers.common["Authorization"] = localStorage.getItem("token")
2021-04-09 16:01:28 +10:00
// BBCode Configuration
VMdEditor.lang.use("en-US", enUS);
hljsTheme.extend((md, hljs) => {
md.set({
html: false,
xhtmlOut: false,
breaks: true,
langPrefix: "language-",
linkify: true,
image: false,
typographer: true,
quotes: "“”‘’"
});
md.disable("image");
hljs.registerLanguage("json", json);
2021-02-02 23:44:45 +11:00
});
2021-04-09 16:01:28 +10:00
// Date Format Configuration
Vue.filter("formatDate", function(value) {
if (value) {
return moment(String(value)).format("hh:mm A, DD/MM/YYYY");
}
});
2021-01-15 23:24:15 +11:00
new Vue({
2021-04-09 16:01:28 +10:00
nprogress,
router,
store,
i18n,
render: h => h(App)
}).$mount("#app");