34 lines
		
	
	
	
		
			769 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			34 lines
		
	
	
	
		
			769 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
|   | const TwoFactorAuthAPI = { | ||
|  |   async setup(password: string) { | ||
|  |     return fetch("/api/auth/two-factor/totp/setup", { | ||
|  |       method: "POST", | ||
|  |       body: JSON.stringify({ password }), | ||
|  |       headers: { | ||
|  |         "Content-Type": "application/json", | ||
|  |       }, | ||
|  |     }); | ||
|  |   }, | ||
|  | 
 | ||
|  |   async enable(code: string) { | ||
|  |     return fetch("/api/auth/two-factor/totp/enable", { | ||
|  |       method: "POST", | ||
|  |       body: JSON.stringify({ code }), | ||
|  |       headers: { | ||
|  |         "Content-Type": "application/json", | ||
|  |       }, | ||
|  |     }); | ||
|  |   }, | ||
|  | 
 | ||
|  |   async disable(password: string) { | ||
|  |     return fetch("/api/auth/two-factor/totp/disable", { | ||
|  |       method: "POST", | ||
|  |       body: JSON.stringify({ password }), | ||
|  |       headers: { | ||
|  |         "Content-Type": "application/json", | ||
|  |       }, | ||
|  |     }); | ||
|  |   }, | ||
|  | }; | ||
|  | 
 | ||
|  | export default TwoFactorAuthAPI; |