forked from DebaucheryLibrarian/traxxx
Tied consent warning to session.
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
<Warning
|
||||
v-if="showWarning"
|
||||
class="warning-container"
|
||||
@enter="closeWarning"
|
||||
@enter="setConsent(true)"
|
||||
@leave="setConsent(false)"
|
||||
/>
|
||||
|
||||
<transition name="slide">
|
||||
@@ -41,9 +42,11 @@ function toggleSidebar(state) {
|
||||
this.showSidebar = typeof state === 'boolean' ? state : !this.showSidebar;
|
||||
}
|
||||
|
||||
function closeWarning() {
|
||||
this.showWarning = false;
|
||||
sessionStorage.setItem('warning', 'warned');
|
||||
async function setConsent(consent) {
|
||||
if (consent) {
|
||||
this.showWarning = false;
|
||||
await this.$store.dispatch('setConsent', true);
|
||||
}
|
||||
}
|
||||
|
||||
function mounted() {
|
||||
@@ -61,7 +64,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
showSidebar: false,
|
||||
showWarning: sessionStorage.getItem('warning') !== 'warned',
|
||||
showWarning: !window.env.consent,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -72,7 +75,7 @@ export default {
|
||||
mounted,
|
||||
methods: {
|
||||
toggleSidebar,
|
||||
closeWarning,
|
||||
setConsent,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<a
|
||||
href="https://www.google.com"
|
||||
class="button leave"
|
||||
@click="$emit('leave')"
|
||||
>Leave</a>
|
||||
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user