Add a logout button on the home page when you are logged in
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user