feat(ui): add loading indicator and error handling
This commit is contained in:
@@ -5,6 +5,7 @@ import { onMounted } from 'vue';
|
||||
import Price from '../components/Price.vue';
|
||||
import useDashboardViewModel from '../viewmodels/DashboardViewModel';
|
||||
import Error from '@/components/Error.vue';
|
||||
import Loading from '@/components/Loading.vue';
|
||||
|
||||
const model = useDashboardViewModel();
|
||||
|
||||
@@ -17,6 +18,7 @@ onMounted(() => {
|
||||
<h1 class="mb-4 text-3xl font-black text-primary">
|
||||
{{ t('dashboard.title') }}
|
||||
</h1>
|
||||
<div v-if="model.isLoading"></div>
|
||||
<div class="mb-4 flex flex-col gap-2" v-if="model.dashboardData.value">
|
||||
<h2 class="text-2xl font-black text-primary">
|
||||
{{ t('dashboard.electricity') }}
|
||||
@@ -135,4 +137,5 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
<Error :message="model.error.value" v-if="model.error.value" />
|
||||
<Loading v-if="model.isLoading.value" />
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user