uuid: string,
}>();
+ const loading = ref(true);
+ const error = ref<Error | null>(null);
const bugs = ref<Bug[] | null>(null);
// Fetch the build
const { getBugs } = useBuild(props.uuid);
onMounted(async () => {
- bugs.value = await getBugs();
-
- console.log(bugs.value);
+ try {
+ bugs.value = await getBugs();
+ } catch (err) {
+ error.value = err as Error;
+ } finally {
+ loading.value = false;
+ }
});
</script>
<template>
<Section :title="$t('Fixed Bugs')">
- <BugList :bugs="bugs" v-if="bugs" />
+ <Loader :loading="loading" :error="error">
+ <BugList :bugs="bugs" v-if="bugs" />
+ </Loader>
</Section>
</template>
+<script setup lang="ts">
+ defineProps<{
+ loading: boolean,
+ error: string,
+ }>()
+</script>
+
<template>
- <div class="is-flex is-justify-content-center">
+ <!-- Show a loading indicator if we are still loading -->
+ <div v-if="loading" class="is-flex is-justify-content-center">
<div class="loader"></div>
</div>
+
+ <!-- Show an error message if there has been an error -->
+ <Notification v-else-if="error" is-danger>
+ {{ error }}
+ </Notification>
+
+ <!-- Otherwise show the content -->
+ <slot v-else />
</template>