1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <template>
- <!-- Don't drop "q-app" class -->
- <div id="q-app">
- <router-view />
- </div>
- </template>
- <script>
- /*
- * Root component
- */
- var db = require('../db.js')
- var utils = require('../utils.js')
- var api = require('../api.js')
- export default {
- methods: {
- redirect_if_not_logged: function (){
- if (this.$route.name == 'login' ||
- this.$route.name == 'oauth_redirect' ||
- this.$route.name == 'register' ) {
- return true
- }
- var self = this
- db.getToken()
- .then(data => {
- if (data.token.length < 4){
- self.$router.push('login')
- self.$q.notify('You must login to access this page')
- }
- })
- .catch(() => {
- self.$router.push('login')
- self.$q.notify('You must login to access this page')
- })
- }
- },
- beforeCreate: function () {
- window.me = this
- window.api = api
- window.db = db
- // check if the user is logged in, if not goto login page
- },
- mounted: function () {
- api.setCurrentPage(this)
- this.redirect_if_not_logged()
- },
- framework: {
- i18n: 'de'
- }
- }
- </script>
- <style></style>
|