elearning/Frontend-Learner/app.vue

24 lines
922 B
Vue
Raw Normal View History

2026-01-14 15:15:31 +07:00
<script setup>
// ดึงฟังก์ชันจัดการ Authentication
2026-01-14 15:15:31 +07:00
const { fetchUserProfile, isAuthenticated } = useAuth()
// เมื่อ App เริ่มทำงาน (Mounted)
// หากผู้ใช้ Login ค้างไว้ (มี Token) ให้ดึงข้อมูล Profile ล่าสุดทันที
2026-01-14 15:15:31 +07:00
onMounted(() => {
if (isAuthenticated.value) {
fetchUserProfile()
}
})
</script>
2026-01-13 10:46:40 +07:00
<template>
<!-- แสดง Loader ระหวางเปลยนหน หรอโหลดขอม -->
2026-01-13 12:55:21 +07:00
<GlobalLoader />
<!-- NuxtLayout: แสดง Layout กำหนดในแตละเพจ (default: layouts/default.vue) -->
2026-01-13 10:46:40 +07:00
<NuxtLayout>
<!-- NuxtPage: แสดงเนอหาของเพจปจจ (ตาม URL routng) -->
2026-01-13 10:46:40 +07:00
<NuxtPage />
</NuxtLayout>
</template>