feat: Scaffold new Nuxt.js application with initial pages, layouts, composables, and middleware.
This commit is contained in:
parent
ab3124628c
commit
9bfb852ad0
8 changed files with 113 additions and 48 deletions
|
|
@ -1,6 +1,9 @@
|
|||
<script setup>
|
||||
// ดึงฟังก์ชันจัดการ Authentication
|
||||
const { fetchUserProfile, isAuthenticated } = useAuth()
|
||||
|
||||
// เมื่อ App เริ่มทำงาน (Mounted)
|
||||
// หากผู้ใช้ Login ค้างไว้ (มี Token) ให้ดึงข้อมูล Profile ล่าสุดทันที
|
||||
onMounted(() => {
|
||||
if (isAuthenticated.value) {
|
||||
fetchUserProfile()
|
||||
|
|
@ -9,8 +12,12 @@ onMounted(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<!-- แสดง Loader ระหว่างเปลี่ยนหน้า หรือโหลดข้อมูล -->
|
||||
<GlobalLoader />
|
||||
|
||||
<!-- NuxtLayout: แสดง Layout ที่กำหนดในแต่ละเพจ (default: layouts/default.vue) -->
|
||||
<NuxtLayout>
|
||||
<!-- NuxtPage: แสดงเนื้อหาของเพจปัจจุบัน (ตาม URL routng) -->
|
||||
<NuxtPage />
|
||||
</NuxtLayout>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue