Created
March 26, 2018 16:28
-
-
Save cosmic-byte/0dfab5ff8c382607eff3dd71b10b9796 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from app.main import db | |
| from app.main.model.blacklist import BlacklistToken | |
| def save_token(token): | |
| blacklist_token = BlacklistToken(token=token) | |
| try: | |
| # insert the token | |
| db.session.add(blacklist_token) | |
| db.session.commit() | |
| response_object = { | |
| 'status': 'success', | |
| 'message': 'Successfully logged out.' | |
| } | |
| return response_object, 200 | |
| except Exception as e: | |
| response_object = { | |
| 'status': 'fail', | |
| 'message': e | |
| } | |
| return response_object, 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should the final return include a 200 code? Perhaps 500 would be more appropriate, since the exception would be raised by database operations?