Add a logout button on the home page when you are logged in

This commit is contained in:
2026-03-19 13:11:43 +01:00
parent 1cb157da42
commit 88895872c4
2 changed files with 12 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View File

@@ -1,6 +1,7 @@
<script setup>
import { computed, ref } from 'vue'
import { Head, router, usePage } from '@inertiajs/vue3'
import { ArrowRightStartOnRectangleIcon } from '@heroicons/vue/20/solid'
import AppLayout from '@/Layouts/AppLayout.vue'
import AppButton from '@/Components/AppButton.vue'
@@ -42,6 +43,8 @@ const userInfo = computed(() => {
const handleContinue = () => {
router.post('/screening')
}
const handleLogout = () => router.post('/logout')
</script>
<template>
@@ -124,6 +127,15 @@ const handleContinue = () => {
>
Continue
</AppButton>
<button
v-if="isAuthenticated"
type="button"
class="mt-3 flex items-center gap-1.5 mx-auto text-sm text-gray-500 hover:text-gray-300 transition-colors duration-150 cursor-pointer"
@click="handleLogout"
>
<ArrowRightStartOnRectangleIcon class="w-4 h-4" />
Log out
</button>
<AppButton v-else size="lg" href="/login" external>
Log in
</AppButton>