import React, { useEffect, useState } from "react"; import { Outlet, useParams } from "react-router-dom"; import JSOG from "jsog"; import OpinionTree from "../Components/OpinionTree"; import { ProfessorCard, ProfessorCardDetails, ProfessorCardName, ProfessorCardSeparator, } from "../Components/ProfessorCard.style"; function Professor(props) { let params = useParams(); let [professor, setProfessor] = useState(null); let [loaded, setLoaded] = useState(null); useEffect(() => { const url = `http://192.168.0.17:8080/public/professor/${params.professorId}`; const fetchData = async () => { try { const response = await fetch(url); var cyclicGraph = await response.json(); var jsogStructure = JSOG.encode(cyclicGraph); // has { '@ref': 'ID' } links instead of cycles cyclicGraph = JSOG.decode(jsogStructure); setProfessor(cyclicGraph); setLoaded(true); } catch (error) { console.log("Error", error); } }; fetchData(); }, []); if (loaded) { return (
се вчитува...