diff --git a/frontend/src/Components/UserProjectListAdmin.tsx b/frontend/src/Components/UserProjectListAdmin.tsx index c4857db..e4bf58c 100644 --- a/frontend/src/Components/UserProjectListAdmin.tsx +++ b/frontend/src/Components/UserProjectListAdmin.tsx @@ -1,15 +1,15 @@ -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { api } from "../API/API"; import { Project } from "../Types/goTypes"; -const UserProjectListAdmin: React.FC = () => { +function UserProjectListAdmin(props: { username: string }): JSX.Element { const [projects, setProjects] = useState([]); useEffect(() => { const fetchProjects = async (): Promise => { try { const token = localStorage.getItem("accessToken") ?? ""; - const username = localStorage.getItem("username") ?? ""; + const username = props.username; const response = await api.getUserProjects(username, token); if (response.success) { @@ -23,7 +23,7 @@ const UserProjectListAdmin: React.FC = () => { }; void fetchProjects(); - }, []); + }); return (
@@ -37,6 +37,6 @@ const UserProjectListAdmin: React.FC = () => {
); -}; +} export default UserProjectListAdmin;