Spookie/assets/js/App.vue

63 lines
1.1 KiB
Vue
Raw Normal View History

2022-05-06 13:52:18 +02:00
<template>
2022-05-11 14:48:04 +02:00
<div class="container-fluid">
<div class="row">
<div class="col">
2022-05-23 16:25:55 +02:00
<the-navbar
@invalidate-user="onUserInvalidate"
2022-05-11 14:48:04 +02:00
/>
</div>
</div>
2022-05-06 13:52:18 +02:00
2022-05-11 14:48:04 +02:00
<div class="row mt-5 main-content">
<div class="col-xl-3">
2022-05-23 16:25:55 +02:00
<the-sidebar/>
2022-05-11 14:48:04 +02:00
</div>
<div class="col-xl-9">
<router-view
@user-authenticated="onUserAuthenticated"
/>
</div>
<div class="col mt-2"/>
</div>
2022-05-06 13:52:18 +02:00
2022-05-11 14:48:04 +02:00
<div class="row">
<div class="col">
2022-05-23 16:25:55 +02:00
<the-footer/>
2022-05-11 14:48:04 +02:00
</div>
</div>
2022-05-06 13:52:18 +02:00
</div>
</template>
2022-05-23 16:25:55 +02:00
<script setup>
2022-05-11 14:48:04 +02:00
import axios from 'axios'
2022-05-23 16:25:55 +02:00
import { useRoute } from 'vue-router'
//import RouterView from 'vue-router'
import TheNavbar from '@/components/TheNavbar'
import TheSidebar from '@/components/TheSidebar'
import TheFooter from '@/components/TheFooter'
2022-05-06 13:52:18 +02:00
2022-05-23 16:25:55 +02:00
if (window.user) {
const { user } = window
}
if (window.quote) {
const { quote } = window
}
2022-05-06 13:52:18 +02:00
2022-05-23 16:25:55 +02:00
const onUserAuthenticated = (userUri) => {
//console.log('authenticated')
axios
.get(userUri)
.then((response) => {
this.user = response.data
})
this.$router.push('/')
2022-05-11 14:48:04 +02:00
}
2022-05-23 16:25:55 +02:00
const onUserInvalidate = () => {
//console.log('invalidated')
this.user = null
window.user = null
}
2022-05-06 13:52:18 +02:00
</script>