Some corrections
This commit is contained in:
parent
36524e5cbb
commit
d2ff2428cd
1 changed files with 5 additions and 5 deletions
|
@ -1,15 +1,15 @@
|
||||||
import React, { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { api } from "../API/API";
|
import { api } from "../API/API";
|
||||||
import { Project } from "../Types/goTypes";
|
import { Project } from "../Types/goTypes";
|
||||||
|
|
||||||
const UserProjectListAdmin: React.FC = () => {
|
function UserProjectListAdmin(props: { username: string }): JSX.Element {
|
||||||
const [projects, setProjects] = useState<Project[]>([]);
|
const [projects, setProjects] = useState<Project[]>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchProjects = async (): Promise<void> => {
|
const fetchProjects = async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
const token = localStorage.getItem("accessToken") ?? "";
|
const token = localStorage.getItem("accessToken") ?? "";
|
||||||
const username = localStorage.getItem("username") ?? "";
|
const username = props.username;
|
||||||
|
|
||||||
const response = await api.getUserProjects(username, token);
|
const response = await api.getUserProjects(username, token);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
|
@ -23,7 +23,7 @@ const UserProjectListAdmin: React.FC = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
void fetchProjects();
|
void fetchProjects();
|
||||||
}, []);
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@ -37,6 +37,6 @@ const UserProjectListAdmin: React.FC = () => {
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
export default UserProjectListAdmin;
|
export default UserProjectListAdmin;
|
||||||
|
|
Loading…
Reference in a new issue