Merge branch 'dev' into gruppDM
This commit is contained in:
commit
f91f0ff8f5
1 changed files with 9 additions and 10 deletions
|
@ -87,14 +87,12 @@ interface API {
|
|||
): Promise<APIResponse<NewWeeklyReport>>;
|
||||
|
||||
/** Gets a weekly report for a specific user, project and week
|
||||
* @param {string} username The username of the user.
|
||||
* @param {string} projectName The name of the project.
|
||||
* @param {string} week The week number.
|
||||
* @param {string} token The authentication token.
|
||||
* @returns {Promise<APIResponse<WeeklyReport>>} A promise resolving to an API response with the retrieved report.
|
||||
*/
|
||||
getWeeklyReport(
|
||||
username: string,
|
||||
projectName: string,
|
||||
week: string,
|
||||
token: string,
|
||||
|
@ -319,20 +317,21 @@ export const api: API = {
|
|||
},
|
||||
|
||||
async getWeeklyReport(
|
||||
username: string,
|
||||
projectName: string,
|
||||
week: string,
|
||||
token: string,
|
||||
): Promise<APIResponse<WeeklyReport>> {
|
||||
try {
|
||||
const response = await fetch("/api/getWeeklyReport", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: "Bearer " + token,
|
||||
const response = await fetch(
|
||||
`/api/getWeeklyReport?projectName=${projectName}&week=${week}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: "Bearer " + token,
|
||||
},
|
||||
},
|
||||
body: JSON.stringify({ username, projectName, week }),
|
||||
});
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
return { success: false, message: "Failed to get weekly report" };
|
||||
|
|
Loading…
Reference in a new issue