From 653b0c41d73072ceaff858bd6257b5d143236439 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Fri, 23 Jan 2026 21:22:19 +0100 Subject: [PATCH] Removed awaits, clean up API route --- frontend/components/ChampionSelector.vue | 4 +- frontend/components/ChampionTitle.vue | 14 ++++-- frontend/components/nav/SideBar.vue | 15 ++++-- frontend/server/api/champion/[alias].ts | 61 +++++++++++++++++++++--- 4 files changed, 77 insertions(+), 17 deletions(-) diff --git a/frontend/components/ChampionSelector.vue b/frontend/components/ChampionSelector.vue index 45e8cec..b0345a6 100644 --- a/frontend/components/ChampionSelector.vue +++ b/frontend/components/ChampionSelector.vue @@ -102,9 +102,9 @@ watch( ) // Navigation -async function navigateToChampion(championAlias: string): Promise { +function navigateToChampion(championAlias: string): void { try { - await navigateTo(`/champion/${championAlias.toLowerCase()}`) + navigateTo(`/champion/${championAlias.toLowerCase()}`) } catch (error) { console.error('Navigation error:', error) } diff --git a/frontend/components/ChampionTitle.vue b/frontend/components/ChampionTitle.vue index 51e85cd..1f3fa53 100644 --- a/frontend/components/ChampionTitle.vue +++ b/frontend/components/ChampionTitle.vue @@ -21,14 +21,20 @@ watch( } ) -const { data: championData }: ChampionResponse = await useFetch( +const { data: championData } = useFetch<{ name: string; title: string }>( CDRAGON_BASE + 'plugins/rcp-be-lol-game-data/global/default/v1/champions/' + props.championId + - '.json' + '.json', + { + lazy: true, // Don't block rendering + server: false // Client-side only + } ) -const championName = championData.value.name -const championDescription = championData.value.title + +// Handle loading and error states +const championName = computed(() => championData.value?.name || 'Loading...') +const championDescription = computed(() => championData.value?.title || '')