Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

main.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* eslint-disable */
  2. import Vue from "vue";
  3. import EvaIcons from "vue-eva-icons";
  4. import axios from "axios";
  5. import moment from "moment";
  6. import App from "./App.vue";
  7. import router from "./router";
  8. import store from "./store";
  9. import * as VueGoogleMaps from "vue2-google-maps";
  10. Vue.use(EvaIcons);
  11. Vue.use(VueGoogleMaps, {
  12. load: {
  13. key: "AIzaSyD8k_Kwml_C8IDfs-gX8JFV8acli3L9cAE",
  14. libraries: "places,directions" // This is required if you use the Autocomplete plugin
  15. // OR: libraries: 'places,drawing'
  16. // OR: libraries: 'places,drawing,visualization'
  17. // (as you require)
  18. //// If you want to set the version, you can do so:
  19. // v: '3.26',
  20. }
  21. });
  22. Vue.config.productionTip = false;
  23. //axios.defaults.baseURL = "http://localhost:57260";
  24. // axios.defaults.baseURL = "http://training.provision-sa.com:82";
  25. axios.defaults.baseURL = "http://localhost:8080/";
  26. Vue.prototype.$axios = axios;
  27. Vue.prototype.$http = axios;
  28. const token = localStorage.getItem("token");
  29. if (token) {
  30. Vue.prototype.$http.defaults.headers.common.Authorization = token;
  31. }
  32. router.beforeEach((to, from, next) => {
  33. if (to.matched.some(record => record.meta.requiresAuth)) {
  34. if (store.getters.isLoggedIn) {
  35. next();
  36. return;
  37. }
  38. next("/users/login");
  39. } else {
  40. next();
  41. }
  42. });
  43. Vue.filter("toCurrency", value => {
  44. if (typeof value !== "number") {
  45. return value;
  46. }
  47. const formatter = new Intl.NumberFormat("en-US", {
  48. minimumFractionDigits: 2
  49. });
  50. return `R ${formatter.format(value)}`;
  51. });
  52. Vue.filter("toProper", value => {
  53. if (typeof value !== "string") {
  54. console.log(typeof value);
  55. return value;
  56. }
  57. value = value.replace(/([a-z])([A-Z])/g, "$1 $2");
  58. return value.charAt(0).toUpperCase() + value.slice(1);
  59. });
  60. Vue.filter("toDate", value => value.substring(0, value.length > 9 ? 10 : value.length));
  61. Vue.filter("toTime", value => moment(String(value)).format("hh:mm"));
  62. new Vue({
  63. render: h => h(App),
  64. router,
  65. store
  66. }).$mount("#app");