Co-authored-by: al8763be <al8763be@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									e1b410c850
								
							
						
					
					
						commit
						d4cc556366
					
				
					 8 changed files with 155 additions and 4 deletions
				
			
		|  | @ -133,6 +133,11 @@ interface API { | |||
|     projectName: string, | ||||
|     token: string, | ||||
|   ): Promise<APIResponse<UserProjectMember[]>>; | ||||
| 
 | ||||
|   removeProject( | ||||
|     projectName: string, | ||||
|     token: string, | ||||
|   ): Promise<APIResponse<string>>; | ||||
| } | ||||
| 
 | ||||
| /** An instance of the API */ | ||||
|  | @ -484,4 +489,34 @@ export const api: API = { | |||
|       }); | ||||
|     } | ||||
|   }, | ||||
| 
 | ||||
|   async removeProject( | ||||
|     projectName: string, | ||||
|     token: string, | ||||
|   ): Promise<APIResponse<string>> { | ||||
|     try { | ||||
|       const response = await fetch(`/api/projectdelete/${projectName}`, { | ||||
|         method: "DELETE", | ||||
|         headers: { | ||||
|           "Content-Type": "application/json", | ||||
|           Authorization: "Bearer " + token, | ||||
|         }, | ||||
|       }); | ||||
| 
 | ||||
|       if (!response.ok) { | ||||
|         return Promise.resolve({ | ||||
|           success: false, | ||||
|           message: "Failed to remove project", | ||||
|         }); | ||||
|       } else { | ||||
|         const data = await response.text(); | ||||
|         return Promise.resolve({ success: true, message: data }); | ||||
|       } | ||||
|     } catch (e) { | ||||
|       return Promise.resolve({ | ||||
|         success: false, | ||||
|         message: "Failed to remove project", | ||||
|       }); | ||||
|     } | ||||
|   }, | ||||
| }; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alexander Ek
						Alexander Ek