Update: Not working
This commit is contained in:
parent
3d3b5fc51e
commit
ee5a164653
6 changed files with 36 additions and 39 deletions
|
|
@ -1,31 +0,0 @@
|
|||
from flask import current_app as app
|
||||
import json
|
||||
|
||||
|
||||
def send_error(status_code, message):
|
||||
data_json = {
|
||||
'status': 'error',
|
||||
'message': message
|
||||
}
|
||||
res = app.response_class(
|
||||
response=json.dumps(data_json, sort_keys=True),
|
||||
status=status_code,
|
||||
mimetype='application/json'
|
||||
)
|
||||
res.headers['Access-Control-Allow-Origin'] = '*'
|
||||
return res
|
||||
|
||||
|
||||
def send_message(message, data):
|
||||
data_json = {
|
||||
'status': 'success',
|
||||
'message': message,
|
||||
'data': data
|
||||
}
|
||||
res = app.response_class(
|
||||
response=json.dumps(data_json, sort_keys=True),
|
||||
status=200,
|
||||
mimetype='application/json'
|
||||
)
|
||||
res.headers['Access-Control-Allow-Origin'] = '*'
|
||||
return res
|
||||
Loading…
Add table
Add a link
Reference in a new issue