|
1 | 1 | <script setup lang="ts"> |
2 | | -import { CheckIcon, ShieldExclamationIcon } from '@heroicons/vue/24/solid'; |
| 2 | +import { CheckIcon } from '@heroicons/vue/24/solid'; |
3 | 3 | import { useQuery } from '@vue/apollo-composable'; |
4 | 4 | import { vInfiniteScroll } from '@vueuse/components'; |
5 | 5 | import { useFragment } from '~/composables/gql/fragment-masking'; |
@@ -28,7 +28,7 @@ watch(props, () => { |
28 | 28 | canLoadMore.value = true; |
29 | 29 | }); |
30 | 30 |
|
31 | | -const { result, error, loading, fetchMore } = useQuery(getNotifications, () => ({ |
| 31 | +const { result, error, loading, fetchMore, refetch } = useQuery(getNotifications, () => ({ |
32 | 32 | filter: { |
33 | 33 | offset: 0, |
34 | 34 | limit: props.pageSize, |
@@ -85,24 +85,10 @@ async function onLoadMore() { |
85 | 85 | </div> |
86 | 86 | </div> |
87 | 87 |
|
88 | | - <div v-else class="h-full flex flex-col items-center justify-center gap-3"> |
89 | | - <!-- Loading State --> |
90 | | - <div v-if="loading" class="contents"> |
91 | | - <LoadingSpinner /> |
92 | | - <p>Loading Notifications...</p> |
93 | | - </div> |
94 | | - <!-- Error State --> |
95 | | - <div v-else-if="error" class="flex gap-3"> |
96 | | - <ShieldExclamationIcon class="h-10 text-unraid-red translate-y-1" /> |
97 | | - <div> |
98 | | - <h3 class="font-bold">{{ `Error` }}</h3> |
99 | | - <p>{{ error.message }}</p> |
100 | | - </div> |
101 | | - </div> |
102 | | - <!-- Empty State --> |
103 | | - <div v-else-if="notifications?.length === 0" class="contents"> |
| 88 | + <LoadingError v-else :loading="loading" :error="error" @retry="refetch"> |
| 89 | + <div v-if="notifications?.length === 0" class="contents"> |
104 | 90 | <CheckIcon class="h-10 text-green-600 translate-y-3" /> |
105 | 91 | {{ `No ${props.importance?.toLowerCase() ?? ''} notifications to see here!` }} |
106 | 92 | </div> |
107 | | - </div> |
| 93 | + </LoadingError> |
108 | 94 | </template> |
0 commit comments