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">
|
|
|
|
<nav-bar
|
|
|
|
:user="user"
|
|
|
|
@invalidate-user="onInvalidateUser"
|
|
|
|
/>
|
|
|
|
</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">
|
|
|
|
<sidebar/>
|
|
|
|
</div>
|
|
|
|
<div class="col-xl-9">
|
|
|
|
<router-view
|
|
|
|
:quote="quote"
|
|
|
|
@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">
|
|
|
|
<footer-component/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-05-06 13:52:18 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-05-11 14:48:04 +02:00
|
|
|
import axios from 'axios'
|
2022-05-06 13:52:18 +02:00
|
|
|
|
2022-05-11 14:48:04 +02:00
|
|
|
import routerView from 'vue-router'
|
|
|
|
import NavBar from '@/components/TheNavbar'
|
|
|
|
import Sidebar from '@/components/TheSidebar'
|
|
|
|
import FooterComponent from '@/components/TheFooter'
|
2022-05-06 13:52:18 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'App',
|
|
|
|
components: {
|
2022-05-11 14:48:04 +02:00
|
|
|
routerView,
|
2022-05-06 13:52:18 +02:00
|
|
|
Sidebar,
|
|
|
|
NavBar,
|
|
|
|
FooterComponent
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
user: null,
|
|
|
|
quote: null
|
2022-05-11 14:48:04 +02:00
|
|
|
}
|
2022-05-06 13:52:18 +02:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
if (window.user) {
|
2022-05-11 14:48:04 +02:00
|
|
|
this.user = window.user
|
|
|
|
console.log(this.user)
|
2022-05-06 13:52:18 +02:00
|
|
|
}
|
|
|
|
if (window.quote) {
|
2022-05-11 14:48:04 +02:00
|
|
|
this.quote = window.quote
|
2022-05-06 13:52:18 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onUserAuthenticated(userUri) {
|
2022-05-11 14:48:04 +02:00
|
|
|
console.log('authenticated')
|
2022-05-06 13:52:18 +02:00
|
|
|
axios
|
|
|
|
.get(userUri)
|
|
|
|
.then((response) => {
|
2022-05-11 14:48:04 +02:00
|
|
|
this.user = response.data
|
|
|
|
})
|
|
|
|
this.$router.push('/')
|
2022-05-06 13:52:18 +02:00
|
|
|
},
|
|
|
|
onInvalidateUser() {
|
2022-05-11 14:48:04 +02:00
|
|
|
console.log('invalidated')
|
|
|
|
this.user = null
|
|
|
|
window.user = null
|
2022-05-06 13:52:18 +02:00
|
|
|
}
|
|
|
|
}
|
2022-05-11 14:48:04 +02:00
|
|
|
}
|
2022-05-06 13:52:18 +02:00
|
|
|
</script>
|