Great big ESLint
This commit is contained in:
parent
051eabbdc3
commit
ebcb938da1
48 changed files with 3890 additions and 2536 deletions
109
src/main.js
109
src/main.js
|
|
@ -1,43 +1,50 @@
|
|||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import store from './store'
|
||||
import Vue from "vue";
|
||||
import App from "./App.vue";
|
||||
import store from "./store";
|
||||
|
||||
import UIkit from 'uikit';
|
||||
import UIkit from "uikit";
|
||||
|
||||
// Import MD icons
|
||||
import 'material-design-icons/iconfont/material-icons.css'
|
||||
import "material-design-icons/iconfont/material-icons.css";
|
||||
|
||||
Vue.config.productionTip = false
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
Vue.mixin({
|
||||
methods: {
|
||||
modalConfirm: function(modalText) {
|
||||
var context = this
|
||||
var context = this;
|
||||
|
||||
// Stop GPU preview to show modal
|
||||
context.$root.$emit('globalTogglePreview', false)
|
||||
|
||||
context.$root.$emit("globalTogglePreview", false);
|
||||
|
||||
var showModal = function(resolve, reject) {
|
||||
UIkit.modal.confirm(modalText)
|
||||
.then(function() {
|
||||
resolve()
|
||||
}, function () {
|
||||
reject()
|
||||
})
|
||||
.finally(function() {
|
||||
// Reenable the GPU preview, if it was active before the modal
|
||||
console.log("Re-enabling GPU preview")
|
||||
if (context.$store.state.globalSettings.autoGpuPreview) {
|
||||
console.log("Re-enabling preview")
|
||||
context.$root.$emit('globalTogglePreview', true)
|
||||
}
|
||||
})
|
||||
}
|
||||
return new Promise(showModal)
|
||||
UIkit.modal
|
||||
.confirm(modalText)
|
||||
.then(
|
||||
function() {
|
||||
resolve();
|
||||
},
|
||||
function() {
|
||||
reject();
|
||||
}
|
||||
)
|
||||
.finally(function() {
|
||||
// Reenable the GPU preview, if it was active before the modal
|
||||
console.log("Re-enabling GPU preview");
|
||||
if (context.$store.state.globalSettings.autoGpuPreview) {
|
||||
console.log("Re-enabling preview");
|
||||
context.$root.$emit("globalTogglePreview", true);
|
||||
}
|
||||
});
|
||||
};
|
||||
return new Promise(showModal);
|
||||
},
|
||||
|
||||
modalNotify: function(message, status = 'success') {
|
||||
UIkit.notification({message: message, status: status})
|
||||
modalNotify: function(message, status = "success") {
|
||||
UIkit.notification({
|
||||
message: message,
|
||||
status: status
|
||||
});
|
||||
},
|
||||
|
||||
modalDialog: function(title, message) {
|
||||
|
|
@ -53,55 +60,57 @@ Vue.mixin({
|
|||
},
|
||||
|
||||
modalError: function(error) {
|
||||
console.log(error)
|
||||
var errormsg = ''
|
||||
console.log(error);
|
||||
var errormsg = "";
|
||||
|
||||
// If a response was obtained
|
||||
if (error.response) {
|
||||
// If the response is a nicely formatted JSON response from the server
|
||||
if (error.response.data.message) {
|
||||
errormsg = `${error.response.status}: ${error.response.data.message}`
|
||||
console.log(errormsg)
|
||||
errormsg = `${error.response.status}: ${error.response.data.message}`;
|
||||
console.log(errormsg);
|
||||
}
|
||||
// If the response is just some generic error response
|
||||
else {
|
||||
errormsg = `${error.response.status}: ${error.response.data}`
|
||||
console.log(errormsg)
|
||||
errormsg = `${error.response.status}: ${error.response.data}`;
|
||||
console.log(errormsg);
|
||||
}
|
||||
// If the error occured during the request
|
||||
// If the error occured during the request
|
||||
} else if (error.request) {
|
||||
errormsg = `${error.message}`
|
||||
console.log(errormsg)
|
||||
// Everything else
|
||||
errormsg = `${error.message}`;
|
||||
console.log(errormsg);
|
||||
// Everything else
|
||||
} else {
|
||||
errormsg = `${error.message}`
|
||||
console.log(errormsg)
|
||||
errormsg = `${error.message}`;
|
||||
console.log(errormsg);
|
||||
}
|
||||
this.$store.commit('setError', errormsg);
|
||||
UIkit.notification({message: `${errormsg}`, status: 'danger'})
|
||||
this.$store.commit("setError", errormsg);
|
||||
UIkit.notification({
|
||||
message: `${errormsg}`,
|
||||
status: "danger"
|
||||
});
|
||||
},
|
||||
|
||||
getLocalStorageObj: function(keyName) {
|
||||
if (localStorage.getItem(keyName)) {
|
||||
try {
|
||||
return JSON.parse(localStorage.getItem(keyName))
|
||||
} catch(e) {
|
||||
console.log("Malformed entry. Removing from localStorage")
|
||||
localStorage.removeItem(keyName)
|
||||
return null
|
||||
return JSON.parse(localStorage.getItem(keyName));
|
||||
} catch (e) {
|
||||
console.log("Malformed entry. Removing from localStorage");
|
||||
localStorage.removeItem(keyName);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setLocalStorageObj: function(keyName, object) {
|
||||
const parsed = JSON.stringify(object)
|
||||
const parsed = JSON.stringify(object);
|
||||
localStorage.setItem(keyName, parsed);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
new Vue({
|
||||
store,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
||||
}).$mount("#app");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue