Skip to content

Commit

Permalink
Home page, login/register for unregister user or categories/addquesti…
Browse files Browse the repository at this point in the history
…on for the user already registered
  • Loading branch information
Strogator committed Apr 26, 2024
1 parent 684161d commit e183bd4
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions frontend/src/views/HomeView.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
<script setup>
import MainLogo from '@/components/icons/FullLogo.vue';
import {getTokenFromCookie} from "@/api_client.js";
import {onMounted, ref} from "vue";
const isConnected = ref(false);
onMounted(() => {
const token = getTokenFromCookie();
if (token !== undefined) {
isConnected.value = true;
} else {
isConnected.value = false;
}
});
</script>

<template>
Expand All @@ -10,9 +24,15 @@ import MainLogo from '@/components/icons/FullLogo.vue';
others?
Whether you're into history, geography, music or film, we've got the perfect quiz for you.
Answer as many questions as you can to become the IQ master.</p>
<p class="info">But first, log in to save your progress:</p>
<RouterLink class="btn" :to="{ name: 'Login' }">Login</RouterLink>
<RouterLink class="btn" :to="{ name: 'Register' }">Register</RouterLink>
<div v-if="isConnected">
<RouterLink class="btn" :to="{ name: 'Categories' }">Categories</RouterLink>
<RouterLink class="btn" :to="{ name: 'Add question' }">Add question</RouterLink>
</div>
<div v-else>
<p class="info">But first, log in to save your progress:</p>
<RouterLink class="btn" :to="{ name: 'Login' }">Login</RouterLink>
<RouterLink class="btn" :to="{ name: 'Register' }">Register</RouterLink>
</div>
</div>
</main>
</template>
Expand Down

0 comments on commit e183bd4

Please sign in to comment.