From 1e9c6440cc2bc1340dd39426acc702928c4545a1 Mon Sep 17 00:00:00 2001 From: Farhaan4 <127176994+Farhaan4@users.noreply.github.com> Date: Thu, 11 Sep 2025 14:12:05 +0700 Subject: [PATCH] tes api kategori & template --- proyek-frontend/app/app.vue | 4 +- .../template-page/CategorySelection.vue | 121 +++++--------- .../components/template-page/TemplateGrid.vue | 150 ++++++++---------- proyek-frontend/nuxt.config.ts | 6 +- 4 files changed, 107 insertions(+), 174 deletions(-) diff --git a/proyek-frontend/app/app.vue b/proyek-frontend/app/app.vue index d136a2c..d07c770 100644 --- a/proyek-frontend/app/app.vue +++ b/proyek-frontend/app/app.vue @@ -1,6 +1,8 @@ diff --git a/proyek-frontend/app/components/template-page/CategorySelection.vue b/proyek-frontend/app/components/template-page/CategorySelection.vue index 8a66ff7..aaaedfb 100644 --- a/proyek-frontend/app/components/template-page/CategorySelection.vue +++ b/proyek-frontend/app/components/template-page/CategorySelection.vue @@ -1,99 +1,50 @@ \ No newline at end of file diff --git a/proyek-frontend/app/components/template-page/TemplateGrid.vue b/proyek-frontend/app/components/template-page/TemplateGrid.vue index 0ec471c..c04192a 100644 --- a/proyek-frontend/app/components/template-page/TemplateGrid.vue +++ b/proyek-frontend/app/components/template-page/TemplateGrid.vue @@ -1,102 +1,78 @@ +const { data: templates, pending: isLoading, error } = useFetch( + () => `/api/templates/category/${props.id_category}`, + { + baseURL: 'http://localhost:8000', + key: () => `templates-${props.id_category}`, + transform: (response) => { + if (!response || !Array.isArray(response)) return []; + return response; + } + } +); + \ No newline at end of file diff --git a/proyek-frontend/nuxt.config.ts b/proyek-frontend/nuxt.config.ts index 7e815b9..b3bb747 100644 --- a/proyek-frontend/nuxt.config.ts +++ b/proyek-frontend/nuxt.config.ts @@ -19,5 +19,9 @@ export default defineNuxtConfig({ tailwindcss(), ], }, - + runtimeConfig: { + public: { + apiBaseUrl: process.env.NUXT_PUBLIC_API_BASE_URL || 'http://localhost:8000' + } + } }) \ No newline at end of file