Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home page, login/register for unregister user or categories/addquesti… #174

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading