Skip to content

Commit

Permalink
Merge pull request #771 from yeatmanlab/fix/tos-popup
Browse files Browse the repository at this point in the history
fix/Terms of Service Popup
  • Loading branch information
ksmontville authored Sep 4, 2024
2 parents 4a2be6b + e685807 commit 1be8dbb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/pages/HomeSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</template>

<script setup>
import { computed, onMounted, ref, toRaw } from 'vue';
import { computed, onMounted, ref, toRaw, watch } from 'vue';
import { useQuery } from '@tanstack/vue-query';
import { useRouter } from 'vue-router';
import { useAuthStore } from '@/store/auth';
Expand Down Expand Up @@ -112,6 +112,7 @@ async function checkConsent() {
// skip the consent for levante
return;
}
// Check for consent
if (isAdmin.value) {
const consentStatus = _get(userData.value, `legal.${consentType.value}`);
Expand Down Expand Up @@ -139,6 +140,13 @@ function isSignedBeforeAugustFirst(signedDate) {
return new Date(signedDate) < augustFirstThisYear;
}
// Only check consent if the user data is loaded
watch(userData, async (newValue) => {
if (!_isEmpty(newValue)) {
await checkConsent();
}
});
onMounted(async () => {
HomeParticipant = (await import('@/pages/HomeParticipant.vue')).default;
HomeAdministrator = (await import('@/pages/HomeAdministrator.vue')).default;
Expand All @@ -151,9 +159,6 @@ onMounted(async () => {
if (roarfirekit.value.restConfig) init();
if (!isLoading.value) {
refreshDocs();
if (isAdmin.value) {
await checkConsent();
}
}
});
</script>

0 comments on commit 1be8dbb

Please sign in to comment.