From 0c9e7c9717f023fa39aeaf1578a53803f5bd1e01 Mon Sep 17 00:00:00 2001 From: Gabriel Rocha Date: Tue, 23 Jan 2024 19:55:29 -0300 Subject: [PATCH] feat: loading on create place and reviews count on place view --- frontend/src/views/HomeView.vue | 7 +++++-- frontend/src/views/PlacesView.vue | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue index 56eaf48..6d81096 100644 --- a/frontend/src/views/HomeView.vue +++ b/frontend/src/views/HomeView.vue @@ -17,6 +17,8 @@ onMounted(() => { async function registerPlace() { try { + isLoading.value = true; + const response = await fetch('https://lmtebcx7dj.execute-api.sa-east-1.amazonaws.com/api' + '/places', { method: 'POST', headers: { @@ -34,8 +36,6 @@ async function registerPlace() { if (placeData.error) { throw new Error('backend:' + placeData.error) } - - isModalOpen.value = false } catch (error) { if (error.message.startsWith('backend:')) { alert(error.message.replace('backend:', '')) @@ -48,6 +48,9 @@ async function registerPlace() { description.value = '' googleMapsUrl.value = '' + isLoading.value = false + isModalOpen.value = false + fetchData() } } diff --git a/frontend/src/views/PlacesView.vue b/frontend/src/views/PlacesView.vue index 762b6fe..5054733 100644 --- a/frontend/src/views/PlacesView.vue +++ b/frontend/src/views/PlacesView.vue @@ -41,10 +41,15 @@ async function fetchData() {

Nota média: {{ data.avarageRating }}

+

Avaliações: {{ data.reviews.length }}

-
+
+

Sem avaliações por enquanto!

+
+ +