Skip to content

Commit 4ab1529

Browse files
committed
fix(typecheck): data.time is possibly undefined
1 parent 20879eb commit 4ab1529

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

components/service/Ping.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
22
<ServiceBase v-bind="props">
33
<template #description>
4-
<template v-if="ping?.time >= 0">
5-
{{ $t('service.ping.description') }} <span class="border-b border-dashed">{{ ping.time }} {{ $t('service.ping.units') }}</span>
4+
<template v-if="data && data?.time >= 0">
5+
{{ $t('service.ping.description') }} <span class="border-b border-dashed">{{ data.time }} {{ $t('service.ping.units') }}</span>
66
</template>
77
<template v-else>
88
{{ $t('service.ping.error') }}
@@ -16,7 +16,7 @@ import type { PingService } from '~/types/services'
1616
1717
const props = defineProps<PingService>()
1818
19-
const { data: ping, refresh } = await useFetch('/api/services/ping', { query: { id: props.id } })
19+
const { data, refresh } = await useFetch<{ time: number }>('/api/services/ping', { query: { id: props.id } })
2020
const { pause } = useIntervalFn(refresh, props?.options?.interval || 10000, { immediate: true })
2121
2222
onBeforeUnmount(pause)

0 commit comments

Comments
 (0)