1
0
mirror of https://github.com/axllent/mailpit.git synced 2024-12-30 23:17:59 +02:00

Tidy JS code

This commit is contained in:
Ralph Slooten 2022-10-16 11:51:20 +13:00
parent 4ebbdab7c0
commit 0a13cf8304
4 changed files with 10 additions and 6 deletions

View File

@ -6,9 +6,11 @@ import Tinycon from 'tinycon';
export default {
mixins: [commonMixins],
components: {
Message
},
data() {
return {
currentPath: window.location.hash,
@ -30,9 +32,10 @@ export default {
selected: [],
tcStatus: 0,
appInfo: false,
lastLoaded: false,
lastLoaded: false
}
},
watch: {
currentPath(v, old) {
if (v && v.match(/^[a-z0-9]+-[a-z0-9]+-[a-z0-9]+-[a-z0-9]+-[a-z0-9]+$/)) {
@ -53,6 +56,7 @@ export default {
}
}
},
computed: {
canPrev: function () {
return this.start > 0;
@ -61,6 +65,7 @@ export default {
return this.total > (this.start + this.count);
}
},
mounted() {
this.currentPath = window.location.hash.slice(1);
window.addEventListener('hashchange', () => {
@ -80,9 +85,9 @@ export default {
this.connect();
this.loadMessages();
},
methods: {
loadMessages: function () {
let now = Date.now()
// prevent double loading when UI loads & websocket connects
if (this.lastLoaded && now - this.lastLoaded < 250) {

View File

@ -5,4 +5,4 @@ import "./assets/styles.scss";
import "../../node_modules/bootstrap-icons/font/bootstrap-icons.scss";
import "bootstrap";
createApp(App).mount('#app')
createApp(App).mount('#app');

View File

@ -12,7 +12,7 @@ FakeModal.prototype.show = function () { alert('open fake modal') }
const commonMixins = {
data() {
return {
loading: 0,
loading: 0
}
},
@ -211,4 +211,4 @@ const commonMixins = {
}
export default commonMixins
export default commonMixins;

View File

@ -35,7 +35,6 @@ export default {
// force eager callback execution
immediate: true
}
},
mounted() {