]> BookStack Code Mirror - bookstack/blobdiff - resources/assets/js/global.js
Started search interface, Added in vue and moved fonts
[bookstack] / resources / assets / js / global.js
index 650919f85e7c243837c02cafce0827bece3fa0ea..7c980f6e9acf7eb698968c48097a816869c70e5e 100644 (file)
@@ -1,12 +1,5 @@
 "use strict";
 
-// AngularJS - Create application and load components
-import angular from "angular";
-import "angular-resource";
-import "angular-animate";
-import "angular-sanitize";
-import "angular-ui-sortable";
-
 // Url retrieval function
 window.baseUrl = function(path) {
     let basePath = document.querySelector('meta[name="base-url"]').getAttribute('content');
@@ -15,6 +8,28 @@ window.baseUrl = function(path) {
     return basePath + '/' + path;
 };
 
+// Vue and axios setup
+import vue from "vue/dist/vue.common";
+import axios from "axios";
+
+let axiosInstance = axios.create({
+    headers: {
+        'X-CSRF-TOKEN': document.querySelector('meta[name=token]').getAttribute('content'),
+        'baseURL': baseUrl('')
+    }
+});
+
+window.Vue = vue;
+window.axios = axiosInstance;
+Vue.prototype.$http = axiosInstance;
+
+// AngularJS - Create application and load components
+import angular from "angular";
+import "angular-resource";
+import "angular-animate";
+import "angular-sanitize";
+import "angular-ui-sortable";
+
 let ngApp = angular.module('bookStack', ['ngResource', 'ngAnimate', 'ngSanitize', 'ui.sortable']);
 
 // Translation setup
@@ -47,6 +62,7 @@ class EventManager {
 }
 
 window.Events = new EventManager();
+Vue.prototype.$events = window.Events;
 
 // Load in angular specific items
 import Services from './services';