removed debugs, reply with 200 OK instead of redirect that is ignored anyway
This commit is contained in:
13
main.py
13
main.py
@@ -1,4 +1,4 @@
|
||||
from flask import Flask, render_template, request, redirect
|
||||
from flask import Flask, render_template, request, redirect, jsonify
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from flask_marshmallow import Marshmallow
|
||||
@@ -588,9 +588,7 @@ def rem_books_from_loan(id):
|
||||
except SQLAlchemyError as e:
|
||||
st.SetAlert("danger")
|
||||
st.SetMessage("Failed to remove books from loan! -- {}".format( e.orig ))
|
||||
|
||||
print ("NOT SURE WHAT TO DO if we dont want output" )
|
||||
return redirect("/loan/{}".format(id))
|
||||
return jsonify(success=True)
|
||||
|
||||
@app.route("/add_books_to_loan/<id>", methods=["POST"])
|
||||
def add_books_to_loan(id):
|
||||
@@ -603,9 +601,7 @@ def add_books_to_loan(id):
|
||||
except SQLAlchemyError as e:
|
||||
st.SetAlert("danger")
|
||||
st.SetMessage("Failed to add books to loan! -- {}".format( e.orig ))
|
||||
|
||||
print ("NOT SURE WHAT TO DO if we dont want output" )
|
||||
return redirect("/loan/{}".format(id))
|
||||
return jsonify(success=True)
|
||||
|
||||
@app.route("/rem_parent_books_from_series/<pid>", methods=["POST"])
|
||||
def rem_parent_books_from_series(pid):
|
||||
@@ -617,8 +613,7 @@ def rem_parent_books_from_series(pid):
|
||||
except SQLAlchemyError as e:
|
||||
st.SetAlert("danger")
|
||||
st.SetMessage("Failed to delete parent & sub books from ALL series! -- {}".format( e.orig ))
|
||||
print ("NOT SURE WHAT TO DO if we dont want output - can we just return a 200?" )
|
||||
return redirect("/")
|
||||
return jsonify(success=True)
|
||||
|
||||
@app.route("/", methods=["GET"])
|
||||
def main_page():
|
||||
|
||||
Reference in New Issue
Block a user