diff --git a/src/main.ts b/src/main.ts index 4fbfb44..ee2d2e9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -11,8 +11,8 @@ import axios from 'axios'; import { AxiosResponse } from "axios"; import { createYmaps } from 'vue-yandex-maps'; -const HOST = "https://cycle-rider.ru"; -// const HOST = "http://localhost:8000"; +// const HOST = "https://cycle-rider.ru"; +const HOST = "http://localhost:8000"; axios.defaults.baseURL = HOST; diff --git a/src/pages/workouts/WorkoutItem.vue b/src/pages/workouts/WorkoutItem.vue index 85dcaec..04f471b 100644 --- a/src/pages/workouts/WorkoutItem.vue +++ b/src/pages/workouts/WorkoutItem.vue @@ -1,34 +1,64 @@ - - - - + + + \ No newline at end of file diff --git a/src/pages/workouts/WorkoutList.vue b/src/pages/workouts/WorkoutList.vue index 5a9b010..7030883 100644 --- a/src/pages/workouts/WorkoutList.vue +++ b/src/pages/workouts/WorkoutList.vue @@ -34,28 +34,9 @@ import { AxiosResponse, AxiosInstance } from "axios"; import { ref, inject } from 'vue'; import { useToast } from "vuestic-ui/web-components"; import { useRouter } from "vue-router"; +import { WorkoutItem, Attachment, secondsToDuration, distConvert, speedConvert } from "./Definitions.vue"; -type Attachment = { - url: string; -} -type WorkoutItem = { - id: string; - name: string; - created_by: string; - created_at: string; - updated_at: string; - description: string; - cadence: number; - heart_rate: number; - temperature: number; - speed: number; - power: number; - duraion_sec: number; - distantion: number; - attachment: Attachment; -}; - const { push } = useRouter(); const axiosAuth= inject('axiosAuth') as AxiosInstance; let workoutItems = ref>([]); @@ -80,19 +61,6 @@ const deleteItem = (id: string) => { }); }; -const secondsToDuration = (seconds: number) => { - var hours = Math.floor(seconds / 3600); - var minutes = Math.floor((seconds % 3600) / 60); - return `${hours} ч. ${minutes} мин.`; -} - -const distConvert = (speed: number) => { - return Math.round(speed/1000) -} - -const speedConvert = (speed: number) => { - return Math.round(speed*3.6) -} const openWorkout = (id: string) => {