Client - fix distance card refresh

This commit is contained in:
Sam 2022-04-02 10:56:56 +02:00
parent 7ca2beded3
commit d1e36e0614

View File

@ -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<Props>()
@ -47,9 +47,11 @@
const unitTo: TUnit = user.value.imperial_units
? units[defaultUnitFrom].defaultTarget
: defaultUnitFrom
const totalDistance = user.value.imperial_units
const totalDistance: ComputedRef<number> = 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<string>) {
const duration = total_duration.value.match(/day/g)