From 1be8b4f2ef426cd3f8f8ef8a5d440e1887bc123b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Viricel?= Date: Fri, 1 Mar 2024 01:28:44 +0100 Subject: [PATCH] refactor: category page + remove PoisList / PoiLayout + use setup and composition API #172 --- components/Layout/Footer.vue | 3 +- components/Layout/Header.vue | 2 + components/PoisList/Actions.vue | 11 +- components/PoisList/PoisList.vue | 144 ------------------ components/PoisList/PoisTable.vue | 49 ++++-- lib/apiPois.ts | 4 +- lib/apiSettings.ts | 4 +- pages/category/[id].vue | 244 +++++++++++------------------- 8 files changed, 144 insertions(+), 317 deletions(-) delete mode 100644 components/PoisList/PoisList.vue diff --git a/components/Layout/Footer.vue b/components/Layout/Footer.vue index 019739997..0c7a340f1 100644 --- a/components/Layout/Footer.vue +++ b/components/Layout/Footer.vue @@ -36,7 +36,8 @@ export default defineNuxtComponent({ > - + + diff --git a/components/Layout/Header.vue b/components/Layout/Header.vue index 40ec50333..97729d7e5 100644 --- a/components/Layout/Header.vue +++ b/components/Layout/Header.vue @@ -43,6 +43,8 @@ export default defineNuxtComponent({ :logo-url="theme && theme.logo_url" /> + +
diff --git a/components/PoisList/Actions.vue b/components/PoisList/Actions.vue index a1ba8b3a3..7986ac534 100644 --- a/components/PoisList/Actions.vue +++ b/components/PoisList/Actions.vue @@ -1,19 +1,16 @@ diff --git a/lib/apiPois.ts b/lib/apiPois.ts index 385ee4dfd..fa6c63fd7 100644 --- a/lib/apiPois.ts +++ b/lib/apiPois.ts @@ -166,13 +166,13 @@ export function getPoiByCategoryIdUrl( ) } -export function getPoiByCategoryId( +export async function getPoiByCategoryId( vidoConfig: VidoConfig, categoryId: number | string, options: ApiPoisOptions = {}, ): Promise { options = Object.assign(defaultOptions, { geometry_as: 'point' }, options) - return fetch(getPoiByCategoryIdUrl(vidoConfig, categoryId, options)).then( + return await fetch(getPoiByCategoryIdUrl(vidoConfig, categoryId, options)).then( (data) => { if (data.ok) { return data.json() as unknown as ApiPois diff --git a/lib/apiSettings.ts b/lib/apiSettings.ts index 23334be8c..8778a1328 100644 --- a/lib/apiSettings.ts +++ b/lib/apiSettings.ts @@ -50,8 +50,8 @@ export interface Settings { themes: SiteInfosTheme[] } -export function getSettings(vidoConfig: VidoConfig): Promise { - return fetch( +export async function getSettings(vidoConfig: VidoConfig): Promise { + return await fetch( `${vidoConfig.API_ENDPOINT}/${vidoConfig.API_PROJECT}/${vidoConfig.API_THEME}/settings.json`, ) .then((data) => { diff --git a/pages/category/[id].vue b/pages/category/[id].vue index b4d9894d5..cad6ceba6 100644 --- a/pages/category/[id].vue +++ b/pages/category/[id].vue @@ -1,171 +1,111 @@ -