Skip to content

Commit

Permalink
feat: sessions with time verification and router guard
Browse files Browse the repository at this point in the history
  • Loading branch information
jvJUCA committed Apr 11, 2024
1 parent ab56084 commit 80084f5
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/views/public/ModeratedTestView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@
<p align="justify" class="description">
{{ test.testDescription }}
</p>
<v-row justify="center" class>
<v-row justify="center">
<v-col cols="12"
><span
style="font-size: 18px;"
class="titleText mt-4 ml-0"
v-if="!isTestAvailable"
>The test is available at
{{ new Date(this.testDate).toLocaleString() }}</span
></v-col
>
<v-btn
:disabled="!isTestAvailable"
color="white"
Expand Down Expand Up @@ -962,10 +971,15 @@ export default {
},
},
async created() {
await this.verifyAdmin()
if (this.token != null) {
this.sessionCooperator = this.test.cooperators.find(
(user) => user.userDocId === this.token,
)
if (!this.user.userDocId !== this.token && !this.isAdmin) {
this.$toast.error(`You don't have access to this session.`)
this.$router.push('/testslist/')
}
if (this.sessionCooperator.testDate) {
this.testDate = this.sessionCooperator.testDate
} else {
Expand All @@ -976,7 +990,7 @@ export default {
this.$toast.info('Use a session your session link to the test')
this.$router.push('/managerview/' + this.test.id)
}
await this.verifyAdmin()
await this.mappingSteps()
this.consentCompleted = this.currentUserTestAnswer.consentCompleted
const ref = doc(db, 'tests/', this.roomTestId)
Expand Down

0 comments on commit 80084f5

Please sign in to comment.