0👍
✅
There’s no need for you to pass the username of the authenticated user and just redirect to the Welcome
page. The HandleInertiaRequest
middleware will handle that for you. If you want to access the authenticated user information you can just use the usePage()
Inside <script setup>
tag
<script setup>
import { computed } from 'vue'
import { usePage } from '@inertiajs/vue3'
const username = computed(() => {
usePage().props.auth.user.username
})
</script>
Inside the <template>
tag
<template>
<span>{{ $page.props.auth.user.username }}</span>
<template>
Source:stackexchange.com