TS Api for getAllWeeklyReport
This commit is contained in:
parent
0a951ecd2b
commit
2ca8c60418
1 changed files with 13 additions and 8 deletions
|
@ -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}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: "Bearer " + token,
|
||||
const response = await fetch(
|
||||
`/api/getAllWeeklyReports/${projectName}?targetUser=${targetUser}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: "Bearer " + token,
|
||||
},
|
||||
},
|
||||
});
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue