2FAuth/resources/js/app.js

51 lines
1.5 KiB
JavaScript
Raw Normal View History

import Vue from 'vue'
2020-10-08 15:38:36 +02:00
import mixins from './mixins'
2020-11-26 20:39:15 +01:00
import VueStorage from './packages/vue-storage'
2022-07-07 18:04:04 +02:00
import i18n from './langs/i18n'
import router from './routes'
import api from './api'
import FontAwesome from './packages/fontawesome'
import Clipboard from './packages/clipboard'
import Notifications from 'vue-notification'
2020-01-14 17:06:59 +01:00
import './components'
Vue.use(Notifications)
2019-05-20 07:37:41 +02:00
const app = new Vue({
el: '#app',
data: {
2022-05-10 08:57:45 +02:00
appSettings: window.appSettings,
appConfig: window.appConfig,
userPreferences: window.userPreferences,
isDemoApp: window.isDemoApp,
isTestingApp: window.isTestingApp,
prefersDarkScheme: window.matchMedia('(prefers-color-scheme: dark)').matches
},
computed: {
showDarkMode: function() {
return this.userPreferences.theme == 'dark' ||
(this.userPreferences.theme == 'system' && this.prefersDarkScheme)
}
},
mounted () {
this.mediaQueryList = window.matchMedia('(prefers-color-scheme: dark)')
this.$nextTick(() => {
this.mediaQueryList.addEventListener('change', this.setDarkScheme)
})
},
beforeDestroy () {
this.mediaQueryList.removeEventListener('change', this.setDarkScheme)
},
methods: {
setDarkScheme ({ matches }) {
this.prefersDarkScheme = matches
}
},
i18n,
2019-05-28 17:29:15 +02:00
router,
});