Some corrections

This commit is contained in:
Peter KW 2024-03-19 00:26:05 +01:00
parent 36524e5cbb
commit d2ff2428cd

View file

@ -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<Project[]>([]);
useEffect(() => {
const fetchProjects = async (): Promise<void> => {
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 (
<div>
@ -37,6 +37,6 @@ const UserProjectListAdmin: React.FC = () => {
</ul>
</div>
);
};
}
export default UserProjectListAdmin;