From 0c9646626308a825f8d01c341bf7c92b1e7916cb Mon Sep 17 00:00:00 2001 From: Alexis Date: Sat, 2 Aug 2025 22:42:23 +0200 Subject: [PATCH] Updated data loading strategy on world page --- .../global/{AddCard.vue => card/Add.vue} | 0 app/components/global/card/Error.vue | 22 ++ .../{LoadingCard.vue => card/Loading.vue} | 0 app/components/world/form/Update.vue | 2 + app/pages/explore.vue | 2 +- app/pages/my/index.vue | 6 +- app/pages/my/worlds/[id].vue | 202 +++++++++++------- i18n/i18n.config.ts | 6 + nuxt.config.ts | 2 +- server/api/worlds/query.get.ts | 7 +- 10 files changed, 159 insertions(+), 90 deletions(-) rename app/components/global/{AddCard.vue => card/Add.vue} (100%) create mode 100644 app/components/global/card/Error.vue rename app/components/global/{LoadingCard.vue => card/Loading.vue} (100%) diff --git a/app/components/global/AddCard.vue b/app/components/global/card/Add.vue similarity index 100% rename from app/components/global/AddCard.vue rename to app/components/global/card/Add.vue diff --git a/app/components/global/card/Error.vue b/app/components/global/card/Error.vue new file mode 100644 index 0000000..9dcc910 --- /dev/null +++ b/app/components/global/card/Error.vue @@ -0,0 +1,22 @@ + + + diff --git a/app/components/global/LoadingCard.vue b/app/components/global/card/Loading.vue similarity index 100% rename from app/components/global/LoadingCard.vue rename to app/components/global/card/Loading.vue diff --git a/app/components/world/form/Update.vue b/app/components/world/form/Update.vue index fb1e470..0c3e593 100644 --- a/app/components/world/form/Update.vue +++ b/app/components/world/form/Update.vue @@ -38,6 +38,8 @@ async function handleSubmit() { if (error) { console.log(error.message) + isLoading.value = false + return } toast({ diff --git a/app/pages/explore.vue b/app/pages/explore.vue index 29a1d42..0a3e1ea 100644 --- a/app/pages/explore.vue +++ b/app/pages/explore.vue @@ -34,7 +34,7 @@ const { data: calendars, status } = useLazyAsyncData<{ data: Calendar[] }>("expl
- +
- + + diff --git a/i18n/i18n.config.ts b/i18n/i18n.config.ts index 42651e7..c82fa02 100644 --- a/i18n/i18n.config.ts +++ b/i18n/i18n.config.ts @@ -241,6 +241,9 @@ export default defineI18nConfig(() => ({ title: "The event \"{event}\" has been successfuly deleted.", }, }, + error: { + cannotFindAny: "We couldn't fetch your calendars…" + }, actionDialog: { tabs: { general: { @@ -571,6 +574,9 @@ export default defineI18nConfig(() => ({ title: "L'évènement \"{event}\" a été supprimé avec succès.", }, }, + error: { + cannotFindAny: "Nous n'avons pas pu récupérer vos calendriers…" + }, actionDialog: { tabs: { general: { diff --git a/nuxt.config.ts b/nuxt.config.ts index bfc0bd5..6c03ccc 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -69,4 +69,4 @@ export default defineNuxtConfig({ eslint: {}, compatibilityDate: "latest", -}) \ No newline at end of file +}) diff --git a/server/api/worlds/query.get.ts b/server/api/worlds/query.get.ts index d0e3b8f..fedd802 100644 --- a/server/api/worlds/query.get.ts +++ b/server/api/worlds/query.get.ts @@ -41,12 +41,7 @@ export default defineEventHandler(async (event) => { state, createdAt:created_at, updatedAt:updated_at, - calendars ( - createdAt:created_at, - updatedAt:updated_at, - months:calendar_months(*), - eventNb:calendar_events(count) - ) + gmId:gm_id ` let output