Changeset 8d83180 for reactapp/src/Pages


Ignore:
Timestamp:
10/11/22 15:41:16 (2 years ago)
Author:
unknown <mlviktor23@…>
Branches:
main
Children:
c68150f
Parents:
cae16b5
Message:

forums/page nav

Location:
reactapp/src/Pages
Files:
4 added
1 edited

Legend:

Unmodified
Added
Removed
  • reactapp/src/Pages/Professor.js

    rcae16b5 r8d83180  
    2323import { useNavigate } from "react-router-dom";
    2424import axios from "../api/axios";
     25import { CurrentPageNav } from "../Components/Styled/Main.style";
    2526
    2627function Professor(user, userLoaded) {
     
    3435  const [postTitle, setPostTitle] = useState("");
    3536  const [postContent, setPostContent] = useState("");
     37  const [fetchError, setFetchError] = useState(false);
    3638
    3739  useEffect(() => {
     
    4749        setLoaded(true);
    4850      } catch (error) {
    49         console.log("Fetching error", error);
     51        setFetchError(true);
    5052      }
    5153    };
     
    9597    return (
    9698      <div>
     99        <CurrentPageNav>
     100          &#187;{" "}
     101          <a href={"/university/" + professor.faculty.university.universityId}>
     102            {professor.faculty.university.universityName}
     103          </a>{" "}
     104          &#187;{" "}
     105          <a href={"/faculty/" + professor.faculty.facultyId}>
     106            {professor.faculty.facultyName}
     107          </a>{" "}
     108          &#187; <a href="#">{professor.professorName}</a>
     109        </CurrentPageNav>
    97110        <ProfessorCard>
    98111          <ProfessorCardName>{professor.professorName}</ProfessorCardName>
     
    168181      </div>
    169182    );
    170   } else {
     183  } else if (!fetchError) {
    171184    return (
    172185      <div>
     
    175188      </div>
    176189    );
     190  } else {
     191    return (
     192      <div style={{ marginTop: "140px" }}>
     193        <h1 style={{ textAlign: "center" }}>Страницата не е пронајдена.</h1>
     194      </div>
     195    );
    177196  }
    178197}
Note: See TracChangeset for help on using the changeset viewer.