RemoveUserFromProject handler implemented, corresponding TS api, untested
This commit is contained in:
		
							parent
							
								
									76ae587116
								
							
						
					
					
						commit
						e67c54540c
					
				
					 4 changed files with 82 additions and 0 deletions
				
			
		|  | @ -201,6 +201,12 @@ interface API { | |||
|     token: string, | ||||
|   ): Promise<APIResponse<void>>; | ||||
| 
 | ||||
|   removeUserFromProject( | ||||
|     user: string, | ||||
|     project: string, | ||||
|     token: string, | ||||
|   ): Promise<APIResponse<void>>; | ||||
| 
 | ||||
|   removeProject( | ||||
|     projectName: string, | ||||
|     token: string, | ||||
|  | @ -359,6 +365,31 @@ export const api: API = { | |||
|     } | ||||
|   }, | ||||
| 
 | ||||
|   async removeUserFromProject( | ||||
|     user: string, | ||||
|     project: string, | ||||
|     token: string, | ||||
|   ): Promise<APIResponse<void>> { | ||||
|     try { | ||||
|       const response = await fetch( | ||||
|         `/api/removeUserFromProject/${project}?userName=${user}`, | ||||
|         { | ||||
|           method: "DELETE", | ||||
|           headers: { | ||||
|             "Content-Type": "application/json", | ||||
|             Authorization: "Bearer " + token, | ||||
|           }, | ||||
|         }, | ||||
|       ); | ||||
|       if (!response.ok) { | ||||
|         return { success: false, message: "Failed to remove member" }; | ||||
|       } | ||||
|     } catch (e) { | ||||
|       return { success: false, message: "Failed to remove member" }; | ||||
|     } | ||||
|     return { success: true, message: "Removed member" }; | ||||
|   }, | ||||
| 
 | ||||
|   async renewToken(token: string): Promise<APIResponse<string>> { | ||||
|     try { | ||||
|       const response = await fetch("/api/loginrenew", { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Imbus
						Imbus