diff --git a/src/AppRoutes.tsx b/src/AppRoutes.tsx
index 1e58496..c7820fa 100644
--- a/src/AppRoutes.tsx
+++ b/src/AppRoutes.tsx
@@ -16,7 +16,7 @@ import { getRouteHome } from "./shared/consts/router";
import { getRouteForgotPassword } from "./shared/consts/router";
import { getRouteCourses } from "./shared/consts/router";
import { getRouteCourseExercises } from "./shared/consts/router";
-import { getRouteExercise } from "./shared/consts/router";
+// import { getRouteExercise } from "./shared/consts/router";
import { getRouteSettings } from "./shared/consts/router";
import { getRouteCourseComplete } from "./shared/consts/router";
@@ -31,8 +31,14 @@ const AppRoutes = () => (
+
+ {/* */}
+
-
+
+
+ {/* */}
+
diff --git a/src/pages/CourseExercises.tsx b/src/pages/CourseExercises.tsx
index efebf37..1fd7653 100644
--- a/src/pages/CourseExercises.tsx
+++ b/src/pages/CourseExercises.tsx
@@ -1,221 +1,93 @@
"use client"
-import { useState } from "react"
-import { useHistory } from "react-router-dom"
+import { useState, useEffect } from "react"
+import { useParams } from "react-router-dom"
import HeaderNav from "../components/HeaderNav"
import BottomNavigation from "../components/BottomNavigation"
-import video from "../assets/img/video.mov"
+
import { connect } from '../confconnect';
-import { getRouteExercise } from "../shared/consts/router"
+
export const CourseExercises = () => {
- const history = useHistory()
- // const { id } = useParams<{ id: string }>();
- const [currentSlide, setCurrentSlide] = useState(0)
+
+ const { id } = useParams<{ id: string }>();
+
+
+ // const id = useParams();
+
+const [pacientData, setPacientData] = useState(null);
+ const token = localStorage.getItem('authToken');
+
+ useEffect(() => {
+ console.log(token)
+ if (!token) {
+ console.log('Токен не найден');
+ return;
+ }
-const course = {
- id: 2,
- description: 'Очень сильно',
- name: 'Качаем ноги',
- exercises: [
- {
- id: 1,
- name: "Подъемы ног лежа",
- duration: "15 мин",
- sets: 3,
- reps: 12,
- image: "/placeholder.svg?height=200&width=300",
- difficulty: "Легкий",
- description: "Укрепление мышц бедра и улучшение подвижности коленного сустава",
- calories: 45,
- },
- {
- id: 2,
- name: "Приседания у стены",
- duration: "10 мин",
- sets: 2,
- reps: 15,
- image: "/placeholder.svg?height=200&width=300",
- difficulty: "Средний",
- description: "Безопасные приседания для восстановления силы ног",
- calories: 60,
- },
- {
- id: 3,
- name: "Растяжка квадрицепса",
- duration: "8 мин",
- sets: 1,
- reps: 30,
- image: "/placeholder.svg?height=200&width=300",
- difficulty: "Легкий",
- description: "Улучшение гибкости и снятие напряжения",
- calories: 25,
- },
- {
- id: 4,
- name: "Укрепление икр",
- duration: "12 мин",
- sets: 3,
- reps: 20,
- image: "/placeholder.svg?height=200&width=300",
- difficulty: "Средний",
- description: "Развитие силы и выносливости икроножных мышц",
- calories: 40,
- },
- ]}
+ connect.get(`/pacient/${id}`, {
+
+ headers: {
+ Authorization: `Bearer ${token}`,
+ },
+
+ })
+ .then(response => {
+ console.log('Response status:', response.status);
+ console.log('Данные:', response.data);
+ setPacientData(response.data);
+
+
+ })
+ .catch(error => {
+ if (error.response) {
+ console.error('Ошибка ответа сервера:', error.response.status, error.response.data);
+
+ } else if (error.request) {
+ console.error('Нет ответа от сервера:', error.request);
+
+ } else {
+ console.error('Ошибка при настройке запроса:', error.message);
+
+ }
+ });
+ }, [token]);
+
- // Функции для переключения на следующее/предыдущее упражнение
- const nextExercise = () => {
- setCurrentSlide((prev) => (prev + 1) % course.exercises.length)
- }
- const prevExercise = () => {
- setCurrentSlide((prev) => (prev - 1 + course.exercises.length) % course.exercises.length)
- }
- const currentExercise = course.exercises[currentSlide]
- // const getDifficultyColor = (difficulty: string) => {
- // switch (difficulty) {
- // case "Легкий":
- // return "bg-gradient-to-r from-emerald-400 to-green-500"
- // case "Средний":
- // return "bg-gradient-to-r from-amber-400 to-orange-500"
- // case "Сложный":
- // return "bg-gradient-to-r from-red-400 to-pink-500"
- // default:
- // return "bg-gradient-to-r from-gray-400 to-gray-500"
- // }
- // }
return (
-
-
-
+
+
+
-
-
- {/* Exercise Slider */}
-
-
- {/* Exercise Image */}
-
-
-
-
- {/* Difficulty Badge */}
-
- {/*
- {currentExercise.difficulty}
-
*/}
-
-
- {/* Navigation arrows */}
-
-
-
-
-
-
-
-
- {/* Exercise Info */}
-
-
{currentExercise.name}
-
-
-
-
-
-
-
- {/* Slide indicators */}
-
- {course.exercises.map((_, index) => (
-
+
+
Перейти на упражнение
+
выводим текст
+ {/* Выводим данные пациента */}
+ {pacientData ? (
+
{JSON.stringify(pacientData, null, 2)}
+ ) : (
+
Нет данных
+ )}
- {/* Exercise List */}
-
-
Все упражнения курса
-
- {course.exercises.map((exercise, index) => (
-
history.push(getRouteExercise(currentExercise.id))}
- className={`glass-morphism rounded-2xl p-4 sm:p-6 border border-white/50 shadow-lg cursor-pointer transition-all duration-300 hover:shadow-2xl transform hover:scale-[1.02] backdrop-blur-xl ${index === currentSlide ? "ring-2 ring-[#2BACBE] bg-cyan-50/20" : ""
- }`}
- >
-
-
-
-
{exercise.name}
-
{exercise.description}
-
-
-
-
-
- ))}
-
-
+
-
+
)
}
diff --git a/src/shared/consts/router.ts b/src/shared/consts/router.ts
index a8aa86a..84ba452 100644
--- a/src/shared/consts/router.ts
+++ b/src/shared/consts/router.ts
@@ -4,8 +4,13 @@ export const getRouteHome = () => `/home`;
export const getRouteForgotPassword = () => `/forgot-password`;
export const getRouteCourses = () => `/courses`;
-export const getRouteCourseExercises = (id: number | string) => `/course/${id}/exercises`;
-export const getRouteExercise = (id: number | string) => `/exercise/${id}`;
+
+
+
+export const getRouteCourseExercises = (id: number | string) => `/pacient/${id}`;
+
+
+export const getRouteExercise = (courseId: number | string, execiseId: number | string) => `/pacient/${courseId}/${execiseId}`;
export const getRouteSettings = () => `/settings`;
export const getRouteCourseComplete = () => `/course-complete`;