feat: Scaffold new Nuxt.js application with initial pages, layouts, composables, and middleware.

This commit is contained in:
supalerk-ar66 2026-01-23 09:54:35 +07:00
parent ab3124628c
commit 9bfb852ad0
8 changed files with 113 additions and 48 deletions

View file

@ -1,4 +1,4 @@
// Interface สำหรับข้อมูลหมวดหมู่ (Category)
export interface Category {
id: number
name: {
@ -24,17 +24,20 @@ export interface CategoryData {
categories: Category[]
}
export interface CategoryResponse {
interface CategoryResponse {
code: number
message: string
data: CategoryData
}
// Composable สำหรับจัดการข้อมูลหมวดหมู่
export const useCategory = () => {
const config = useRuntimeConfig()
const API_BASE_URL = config.public.apiBase as string
const { token } = useAuth()
// ฟังก์ชันดึงข้อมูลหมวดหมู่ทั้งหมด
// Endpoint: GET /categories
const fetchCategories = async () => {
try {
const response = await $fetch<CategoryResponse>(`${API_BASE_URL}/categories`, {