Small fixes in all files that fetches user projects, so that they pass username as argument to GetProjects-function

This commit is contained in:
Peter KW 2024-03-28 21:31:30 +01:00
parent 85795f5406
commit b036ef906c
6 changed files with 28 additions and 28 deletions

View file

@ -114,10 +114,14 @@ interface API {
): Promise<APIResponse<WeeklyReport[]>>;
/** Gets all the projects of a user
* @param {string} username - The authentication token.
* @param {string} token - The authentication token.
* @returns {Promise<APIResponse<Project[]>>} A promise containing the API response with the user's projects.
*/
getUserProjects(token: string): Promise<APIResponse<Project[]>>;
getUserProjects(
username: string,
token: string,
): Promise<APIResponse<Project[]>>;
/** Gets a project by its id.
* @param {number} id The id of the project to retrieve.
@ -302,9 +306,12 @@ export const api: API = {
}
},
async getUserProjects(token: string): Promise<APIResponse<Project[]>> {
async getUserProjects(
username: string,
token: string,
): Promise<APIResponse<Project[]>> {
try {
const response = await fetch("/api/getUserProjects", {
const response = await fetch(`/api/getUserProjects/${username}`, {
method: "GET",
headers: {
"Content-Type": "application/json",