From d1e36e061463512be92450b58ac9323e302a9be3 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 2 Apr 2022 10:56:56 +0200 Subject: [PATCH] Client - fix distance card refresh --- .../components/Dashboard/UserStatsCards/index.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fittrackee_client/src/components/Dashboard/UserStatsCards/index.vue b/fittrackee_client/src/components/Dashboard/UserStatsCards/index.vue index ed14e004..6a9314bb 100644 --- a/fittrackee_client/src/components/Dashboard/UserStatsCards/index.vue +++ b/fittrackee_client/src/components/Dashboard/UserStatsCards/index.vue @@ -29,10 +29,10 @@ import StatCard from '@/components/Common/StatCard.vue' import { TUnit } from '@/types/units' - import { IUserProfile } from '@/types/user' + import { IAuthUserProfile } from '@/types/user' import { convertDistance, units } from '@/utils/units' interface Props { - user: IUserProfile + user: IAuthUserProfile } const props = defineProps() @@ -47,9 +47,11 @@ const unitTo: TUnit = user.value.imperial_units ? units[defaultUnitFrom].defaultTarget : defaultUnitFrom - const totalDistance = user.value.imperial_units - ? convertDistance(user.value.total_distance, defaultUnitFrom, unitTo, 2) - : parseFloat(user.value.total_distance.toFixed(2)) + const totalDistance: ComputedRef = computed(() => + user.value.imperial_units + ? convertDistance(user.value.total_distance, defaultUnitFrom, unitTo, 2) + : parseFloat(user.value.total_distance.toFixed(2)) + ) function get_duration(total_duration: ComputedRef) { const duration = total_duration.value.match(/day/g)