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