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