parsley/app/javascript/components/App.vue

64 lines
1.2 KiB
Vue
Raw Normal View History

2018-03-29 01:57:00 -05:00
<template>
2018-03-30 14:31:09 -05:00
<div>
2018-04-01 21:43:23 -05:00
<vue-progress-bar></vue-progress-bar>
2018-03-30 14:31:09 -05:00
<app-navbar></app-navbar>
2018-04-01 21:43:23 -05:00
<section id="app" class="">
2018-03-30 14:31:09 -05:00
<div class="container">
<router-view v-if="!hasError"></router-view>
<div v-else>
<h1>Error!</h1>
<p>{{error}}</p>
</div>
</div>
</section>
2018-03-29 01:57:00 -05:00
</div>
</template>
<script>
2018-03-30 17:08:09 -05:00
import { mapMutations, mapState } from "vuex";
import api from "../lib/Api";
2018-09-13 14:51:41 -05:00
import TWEEN from '@tweenjs/tween.js';
2018-03-30 14:31:09 -05:00
2018-03-29 01:57:00 -05:00
export default {
2018-04-01 21:43:23 -05:00
data() {
return {
api: api
};
},
2018-03-30 14:31:09 -05:00
computed: {
...mapState({
hasError: state => state.error !== null,
2018-03-30 17:08:09 -05:00
error: state => state.error,
authChecked: state => state.authChecked
2018-03-30 14:31:09 -05:00
})
},
2018-03-29 01:57:00 -05:00
2018-04-01 21:43:23 -05:00
watch: {
isLoading(val) {
if (val) {
this.$Progress.start();
} else {
this.$Progress.finish();
}
}
},
created() {
2018-09-13 14:51:41 -05:00
// Setup global animation loop
function animate () {
TWEEN.update();
requestAnimationFrame(animate);
}
animate();
2018-03-30 17:08:09 -05:00
if (this.user === null && this.authChecked === false) {
2018-06-09 12:36:46 -05:00
this.checkAuthentication();
2018-03-30 17:08:09 -05:00
}
},
2018-03-30 14:31:09 -05:00
components: {
}
2018-03-29 01:57:00 -05:00
}
</script>