From d2ff2428cd6a08aa440c10a11b9507ea6231694a Mon Sep 17 00:00:00 2001 From: Peter KW Date: Tue, 19 Mar 2024 00:26:05 +0100 Subject: [PATCH] Some corrections --- frontend/src/Components/UserProjectListAdmin.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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;