Updating typescript api
This commit is contained in:
parent
903132e56d
commit
a1d2520d88
1 changed files with 7 additions and 2 deletions
|
@ -99,16 +99,20 @@ interface API {
|
|||
token: string,
|
||||
): Promise<APIResponse<string>>;
|
||||
|
||||
/** Gets a weekly report for a specific user, project and week
|
||||
/** Gets a weekly report for a specific user, project and week.
|
||||
* Keep in mind that the user within the token needs to be PM
|
||||
* of the project to get the report, unless the user is the target user.
|
||||
* @param {string} projectName The name of the project.
|
||||
* @param {string} week The week number.
|
||||
* @param {string} token The authentication token.
|
||||
* @param {string} targetUser The username of the target user. Defaults to token user.
|
||||
* @returns {Promise<APIResponse<WeeklyReport>>} A promise resolving to an API response with the retrieved report.
|
||||
*/
|
||||
getWeeklyReport(
|
||||
projectName: string,
|
||||
week: string,
|
||||
token: string,
|
||||
targetUser?: string,
|
||||
): Promise<APIResponse<WeeklyReport>>;
|
||||
|
||||
/**
|
||||
|
@ -529,10 +533,11 @@ export const api: API = {
|
|||
projectName: string,
|
||||
week: string,
|
||||
token: string,
|
||||
targetUser?: string,
|
||||
): Promise<APIResponse<WeeklyReport>> {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`/api/getWeeklyReport?projectName=${projectName}&week=${week}`,
|
||||
`/api/getWeeklyReport?projectName=${projectName}&week=${week}&targetUser=${targetUser}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
|
Loading…
Reference in a new issue