Merge pull request #281 from talvasconcelos/fix/streamAlertsUI

Fix UI issue on service creation
This commit is contained in:
fiatjaf 2021-08-02 07:05:53 -03:00 committed by GitHub
commit 4a84204523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,12 +39,13 @@ from ..satspay.crud import create_charge, get_charge
)
async def api_create_service():
"""Create a service, which holds data about how/where to post donations"""
service = await create_service(**g.data)
wallet = await get_wallet(service.wallet)
user = wallet.user
redirect_url = request.scheme + "://" + request.headers["Host"]
redirect_url += f"/streamalerts/?usr={user}&created={str(service.id)}"
return redirect(redirect_url)
try:
service = await create_service(**g.data)
except Exception as e:
return jsonify({"message": str(e)}), HTTPStatus.INTERNAL_SERVER_ERROR
return jsonify(service._asdict()), HTTPStatus.CREATED
@streamalerts_ext.route("/api/v1/getaccess/<service_id>", methods=["GET"])