getAllUsersProject uses new type
This commit is contained in:
		
							parent
							
								
									cd452459c2
								
							
						
					
					
						commit
						d1be752ac3
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		|  | @ -4,7 +4,7 @@ import { | |||
|   User, | ||||
|   Project, | ||||
|   NewProject, | ||||
|   PublicUser, | ||||
|   UserProjectMember, | ||||
| } from "../Types/goTypes"; | ||||
| 
 | ||||
| // This type of pattern should be hard to misuse
 | ||||
|  | @ -52,7 +52,7 @@ interface API { | |||
|   getAllUsersProject( | ||||
|     projectName: string, | ||||
|     token: string, | ||||
|   ): Promise<APIResponse<PublicUser[]>>; | ||||
|   ): Promise<APIResponse<UserProjectMember[]>>; | ||||
| } | ||||
| 
 | ||||
| // Export an instance of the API
 | ||||
|  | @ -318,7 +318,7 @@ export const api: API = { | |||
|   async getAllUsersProject( | ||||
|     projectName: string, | ||||
|     token: string, | ||||
|   ): Promise<APIResponse<PublicUser[]>> { | ||||
|   ): Promise<APIResponse<UserProjectMember[]>> { | ||||
|     try { | ||||
|       const response = await fetch(`/api/getUsersProject/${projectName}`, { | ||||
|         method: "GET", | ||||
|  | @ -334,7 +334,7 @@ export const api: API = { | |||
|           message: "Failed to get users", | ||||
|         }); | ||||
|       } else { | ||||
|         const data = (await response.json()) as User[]; | ||||
|         const data = (await response.json()) as UserProjectMember[]; | ||||
|         return Promise.resolve({ success: true, data }); | ||||
|       } | ||||
|     } catch (e) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Peter KW
						Peter KW