feat(fe): started working on header

This commit is contained in:
Marco Cavalli 2025-02-28 17:46:06 +01:00
parent 03551436dc
commit d31f88cbd3
9 changed files with 209 additions and 20 deletions

View file

@ -1,30 +1,14 @@
<script setup lang="ts">
import axios from 'axios'
import { ref } from 'vue'
import {useAuthStore} from "@/stores/auth.store.ts";
import Header from "@/layouts/partials/Header.vue";
const userData = ref(null)
const isLoading = ref(true)
const auth = useAuthStore();
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>
<Header />
<router-link to="/login"> Take me to login page </router-link>
</div>
</template>