| 
									
										
										
										
											2021-10-03 18:38:45 -08:00
										 |  |  | import { BaseAPI } from "./_base"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const routes = { | 
					
						
							|  |  |  |   base: "/api/admin/email", | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  |   forgotPassword: "/api/users/forgot-password", | 
					
						
							| 
									
										
										
										
											2021-10-04 20:16:37 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   invitation: "/api/groups/invitations/email", | 
					
						
							| 
									
										
										
										
											2021-10-03 18:38:45 -08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  | export interface EmailResponse { | 
					
						
							| 
									
										
										
										
											2021-10-03 18:38:45 -08:00
										 |  |  |   success: boolean; | 
					
						
							|  |  |  |   error: string; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  | export interface EmailPayload { | 
					
						
							| 
									
										
										
										
											2021-10-03 18:38:45 -08:00
										 |  |  |   email: string; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-04 20:16:37 -08:00
										 |  |  | export interface InvitationEmail { | 
					
						
							|  |  |  |   email: string; | 
					
						
							|  |  |  |   token: string; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-03 18:38:45 -08:00
										 |  |  | export class EmailAPI extends BaseAPI { | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  |   test(payload: EmailPayload) { | 
					
						
							|  |  |  |     return this.requests.post<EmailResponse>(routes.base, payload); | 
					
						
							| 
									
										
										
										
											2021-10-03 18:38:45 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  |   sendInvitation(payload: InvitationEmail) { | 
					
						
							|  |  |  |     return this.requests.post<EmailResponse>(routes.invitation, payload); | 
					
						
							| 
									
										
										
										
											2021-10-03 18:38:45 -08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-10-04 20:16:37 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  |   sendForgotPassword(payload: EmailPayload) { | 
					
						
							|  |  |  |     return this.requests.post<EmailResponse>(routes.forgotPassword, payload); | 
					
						
							| 
									
										
										
										
											2021-10-04 20:16:37 -08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-10-03 18:38:45 -08:00
										 |  |  | } |