TS Api for getAllWeeklyReport
This commit is contained in:
		
							parent
							
								
									a39cfedad3
								
							
						
					
					
						commit
						fcd035fe6e
					
				
					 1 changed files with 14 additions and 9 deletions
				
			
		|  | @ -100,7 +100,7 @@ interface API { | |||
|   ): Promise<APIResponse<string>>; | ||||
| 
 | ||||
|   /** Gets a weekly report for a specific user, project and week. | ||||
|    * Keep in mind that the user within the token needs to be PM  | ||||
|    * 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. | ||||
|  | @ -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 | ||||
|  | @ -558,18 +559,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…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Imbus
						Imbus