Skip to content

Commit

Permalink
Use auth user on HomeView
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Jul 10, 2024
1 parent 372381f commit 54fa1b0
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions app/assets/views/HomeView.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<script setup lang="ts">
interface User {
firstName: string
lastName: string
role: string
}
import { computed } from 'vue'
import { useAuthStore } from '@userfrosting/sprinkle-account/stores'
const user: User = {
firstName: 'Angela',
lastName: 'Davis',
role: 'Professor'
}
const auth = useAuthStore()
const helloMsg: string = 'Hello ' + user.firstName + ' ' + user.lastName + '!'
const helloMsg = computed(() => {
return (auth.isAuthenticated) ? 'Hello ' + auth.user?.full_name + '!' : 'Hello guest !'
})
</script>

<template>
Expand All @@ -20,8 +15,8 @@ const helloMsg: string = 'Hello ' + user.firstName + ' ' + user.lastName + '!'
<a class="uk-link-reset" href="#">{{ helloMsg }}</a>
</h1>
<p class="uk-article-meta">
Written by <a href="#">{{ user.firstName }} {{ user.lastName }}</a
>, {{ user.role }} on 29 September 2018.
Written by <a href="#">Angela Davis</a
>, Professor on 29 September 2018.
</p>
<p class="uk-text-lead">
This is a demo of UserFrosting using a custom UiKit based template built using Vue
Expand Down

0 comments on commit 54fa1b0

Please sign in to comment.