TS Api for getAllWeeklyReport

This commit is contained in:
Imbus 2024-04-03 17:32:07 +02:00 committed by Peter KW
parent 0a951ecd2b
commit 2ca8c60418

View file

@ -122,9 +122,10 @@ interface API {
* @param {string} token The token of the user
* @returns {APIResponse<WeeklyReport[]>} A list of weekly reports
*/
getWeeklyReportsForUser(
getAllWeeklyReportsForUser(
projectName: string,
token: string,
targetUser?: string,
): Promise<APIResponse<WeeklyReport[]>>;
/** Gets all the projects of a user
@ -560,18 +561,22 @@ export const api: API = {
}
},
async getWeeklyReportsForUser(
async getAllWeeklyReportsForUser(
projectName: string,
token: string,
targetUser?: string,
): Promise<APIResponse<WeeklyReport[]>> {
try {
const response = await fetch(`/api/getWeeklyReportsUser/${projectName}`, {
const response = await fetch(
`/api/getAllWeeklyReports/${projectName}?targetUser=${targetUser}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + token,
},
});
},
);
if (!response.ok) {
return {