This commit is contained in:
40
src/main.js
40
src/main.js
@@ -3,6 +3,8 @@ import App from './App.vue'
|
||||
import router from './router'
|
||||
import store from './store'
|
||||
|
||||
import axios from 'axios'
|
||||
|
||||
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
|
||||
|
||||
import 'bootstrap/dist/css/bootstrap.css'
|
||||
@@ -13,6 +15,44 @@ Vue.use(IconsPlugin)
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
Vue.prototype.$api = axios.create({
|
||||
baseURL: process.env.VUE_APP_API_LOCATION
|
||||
});
|
||||
|
||||
Vue.prototype.$showToast = function (text, type = 'error', local=true) {
|
||||
|
||||
let options = {}
|
||||
switch (type) {
|
||||
case "error":
|
||||
options = {
|
||||
title: "Error!",
|
||||
variant: "danger"
|
||||
}
|
||||
break;
|
||||
case "user_error":
|
||||
options = {
|
||||
title: "Oopsie woopsie",
|
||||
variant: "warning"
|
||||
}
|
||||
break;
|
||||
case "success":
|
||||
options = {
|
||||
title: "Success!",
|
||||
variant: "success"
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
const bvToast = local ? this.$bvToast : this.$root.$bvToast
|
||||
|
||||
bvToast.toast(text, {
|
||||
...options,
|
||||
toaster: 'b-toaster-top-right',
|
||||
solid: true,
|
||||
appendToast: false
|
||||
})
|
||||
}
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
|
||||
Reference in New Issue
Block a user