34 lines
No EOL
738 B
Vue
34 lines
No EOL
738 B
Vue
<script setup lang="ts">
|
|
import axios from 'axios'
|
|
import { ref } from 'vue'
|
|
|
|
const userData = ref(null)
|
|
const isLoading = ref(true)
|
|
|
|
const fetchUserData = async () => {
|
|
try {
|
|
// Replace http://127.0.0.1:8000 with Laravel domain
|
|
const response = await axios.get('http://127.0.0.1:9876/api/secured')
|
|
if (response.status === 200 && response.data.user) {
|
|
userData.value = response.data
|
|
}
|
|
} catch (error) {
|
|
// Handle errors appropriately (e.g., display an error message)
|
|
console.error(error)
|
|
}
|
|
isLoading.value = false
|
|
}
|
|
|
|
await fetchUserData()
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<h2>HOME</h2>
|
|
<router-link to="/login"> Take me to login page </router-link>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
|
|
</style> |