mirror of
				https://github.com/fastapi-users/fastapi-users.git
				synced 2025-11-04 14:45:50 +08:00 
			
		
		
		
	* Fix #68: use makefun to generate dynamic dependencies * Remove every Starlette imports * Split every routers and remove event handlers * Make users router optional * Pass after_update handler to get_users_router * Update documentation * Remove test file * Write migration doc for splitted routers
		
			
				
	
	
		
			16 lines
		
	
	
		
			426 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			426 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import asyncio
 | 
						|
from typing import Callable
 | 
						|
 | 
						|
 | 
						|
class ErrorCode:
 | 
						|
    REGISTER_USER_ALREADY_EXISTS = "REGISTER_USER_ALREADY_EXISTS"
 | 
						|
    LOGIN_BAD_CREDENTIALS = "LOGIN_BAD_CREDENTIALS"
 | 
						|
    RESET_PASSWORD_BAD_TOKEN = "RESET_PASSWORD_BAD_TOKEN"
 | 
						|
 | 
						|
 | 
						|
async def run_handler(handler: Callable, *args, **kwargs):
 | 
						|
    if asyncio.iscoroutinefunction(handler):
 | 
						|
        await handler(*args, **kwargs)
 | 
						|
    else:
 | 
						|
        handler(*args, **kwargs)
 |