import Vue from 'vue'; class OVDashboardPlugin { public install(vue: typeof Vue) { vue.prototype.$ovdashboard = this; } private get api_baseurl(): string { if (process.env.NODE_ENV === "production") { return "//" + window.location.host + "/api/v1"; } else { if (process.env.NODE_ENV !== "development") { console.warn("Unexpected NODE_ENV value"); } return "//" + window.location.hostname + ":8000/api/v1"; } } public api_url(endpoint?: string): string { if (endpoint === undefined) return this.api_baseurl; else return this.api_baseurl + "/" + endpoint; } } export default new OVDashboardPlugin();