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