This commit is contained in:
2018-11-28 00:38:00 +00:00
parent 8d725df6d2
commit 8c66647e20
6 changed files with 44 additions and 30 deletions

View File

@@ -10,36 +10,13 @@ import "./registerServiceWorker";
import errorHandler from "./utils/errorhandler";
import NProgress from "nprogress";
import "nprogress/nprogress.css";
import dayjs from "dayjs";
Vue.config.productionTip = false;
Vue.config.errorHandler = errorHandler.handleVueError;
window.onerror = errorHandler.handleGeneralError;
//Loading indicator on route change, probably don't need this
//but do need one for ajax calls
// router.beforeResolve((to, from, next) => {
// // If this isn't an initial page load.
// from;
// if (to.name) {
// // Start the route progress bar.
// //NProgress.start()
// // eslint-disable-next-line
// console.log("---===LOADING===---");
// }
// next();
// });
// router.afterEach((to, from) => {
// // Complete the animation of the route progress bar.
// //NProgress.done()
// to;
// from;
// // eslint-disable-next-line
// console.log("---===FINISHED LOADING===---");
// });
// Store a copy of the fetch function
var _oldFetch = fetch;
@@ -88,6 +65,31 @@ document.addEventListener("fetchEnd", function() {
NProgress.done();
});
//TODO: Will need currency symbol, date format from user settings at server
//rather than try to use local browser settings which is fraught with peril will need to be specified at server itself
Vue.filter("capitalize", function(value) {
if (!value) return "";
value = value.toString();
return value.charAt(0).toUpperCase() + value.slice(1);
});
Vue.filter("shortdate", function(value) {
if (!value) return "";
var dj = dayjs(value);
return dj.format("YYYY-MM-DD hh:mm:ss A");
});
Vue.filter("currency", function(value) {
if (!value) return "";
return "$" + value;
});
Vue.filter("boolastext", function(value) {
if (!value) return "";
return value ? "Yes" : "Nope";
});
new Vue({
router,
store,