2019-04-10 10:47:45 +02:00
|
|
|
<template lang="html">
|
2019-04-11 00:12:23 +02:00
|
|
|
<UserTools v-if="isloggedin" />
|
2019-05-31 23:05:37 +02:00
|
|
|
<LoginBlock v-bind:title="title" v-bind:block="block" v-else/>
|
2019-04-10 10:47:45 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapState, mapActions } from 'vuex'
|
|
|
|
|
2019-05-31 23:05:37 +02:00
|
|
|
import LoginBlock from 'vuejs/components/Block/LoginBlock'
|
2019-04-10 10:47:45 +02:00
|
|
|
import UserTools from 'vuejs/components/User/UserTools'
|
|
|
|
|
2019-05-31 23:05:37 +02:00
|
|
|
import { MA } from 'vuejs/api/ma-axios'
|
|
|
|
|
2019-04-10 10:47:45 +02:00
|
|
|
export default {
|
2019-05-31 23:05:37 +02:00
|
|
|
props: ['title', 'loginblock'],
|
|
|
|
data(){
|
|
|
|
return {
|
|
|
|
block: null
|
|
|
|
}
|
|
|
|
},
|
2019-04-10 10:47:45 +02:00
|
|
|
computed: {
|
|
|
|
...mapState({
|
2019-04-11 00:12:23 +02:00
|
|
|
isloggedin: state => state.User.isloggedin
|
2019-04-10 10:47:45 +02:00
|
|
|
})
|
|
|
|
},
|
2019-05-31 23:05:37 +02:00
|
|
|
beforeMount() {
|
2021-03-31 18:42:05 +02:00
|
|
|
console.log('UserBlock beforeMount')
|
|
|
|
if (this.loginblock) {
|
2019-05-31 23:05:37 +02:00
|
|
|
this.block = this.loginblock
|
2021-03-31 18:42:05 +02:00
|
|
|
} else {
|
2019-05-31 23:05:37 +02:00
|
|
|
this.getLoginBlock()
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getLoginBlock(){
|
|
|
|
MA.get(`/materio_user/login_block`)
|
|
|
|
.then(({data}) => {
|
2021-03-31 18:42:05 +02:00
|
|
|
// console.log("getLoginBlock data", data)
|
2019-05-31 23:05:37 +02:00
|
|
|
this.block = data.rendered
|
|
|
|
})
|
2021-03-31 18:42:05 +02:00
|
|
|
.catch((error) => {
|
2019-05-31 23:05:37 +02:00
|
|
|
console.warn('Issue with getLoginBlock', error)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
2019-04-10 10:47:45 +02:00
|
|
|
components: {
|
2019-05-31 23:05:37 +02:00
|
|
|
LoginBlock,
|
2019-04-10 10:47:45 +02:00
|
|
|
UserTools
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="css" scoped>
|
|
|
|
|
|
|
|
</style>
|