import React, { useCallback, useEffect, useState } from 'react'; import { useParams } from 'react-router-dom'; import { ArrowImg, IconButton, InputElement, InputLabel, InputWrapper, LessonItem, Lessonname, MainWrapper, StartWrapper } from './style'; import arrow from '../assets/36-arrow-right.svg'; import { api } from '../__data__/api/api'; import dayjs from 'dayjs'; export const UserPage = () => { const [socketId, setSocketId] = useState(null); const [error, setError] = useState(null); const { lessonId, accessId } = useParams(); const acc = api.useGetAccessQuery({ accessCode: accessId }) const ls = api.useLessonByIdQuery(lessonId, { pollingInterval: 1000, skipPollingIfUnfocused: true }); useEffect(() => { // socket.on('connect', () => { // const id = localStorage.getItem('socketId'); // if (!id) { // localStorage.setItem('socketId', socket.id); // setSocketId(socket.id); // } else { // setSocketId(id); // } // const name = localStorage.getItem('name'); // if (name) { // const socket = getSocket(); // socket.emit('add', { socketId: id || socket.id, name, lessonid: lessonId }); // } // }) // socket.on('error', data => { // setError(data) // }) }, []); const [value, setValue] = useState(localStorage.getItem('name') || ''); return ( {acc.isLoading &&

Отправляем запрос

} {acc.isSuccess &&

Успешно

}

Тема занятия - {ls.data?.body?.name}

{dayjs(ls.data?.body?.date).format('DD MMMM YYYYг.')}
) }