fix: redirect to homepage when no more user_wallets are found
This commit is contained in:
+8
-7
@@ -30,8 +30,8 @@ def home():
|
|||||||
|
|
||||||
@app.route("/deletewallet")
|
@app.route("/deletewallet")
|
||||||
def deletewallet():
|
def deletewallet():
|
||||||
theid = request.args.get("usr")
|
user_id = request.args.get("usr")
|
||||||
thewal = request.args.get("wal")
|
wallet_id = request.args.get("wal")
|
||||||
|
|
||||||
with Database() as db:
|
with Database() as db:
|
||||||
db.execute(
|
db.execute(
|
||||||
@@ -42,14 +42,15 @@ def deletewallet():
|
|||||||
inkey = 'del:' || w.inkey
|
inkey = 'del:' || w.inkey
|
||||||
WHERE id = ? AND user = ?
|
WHERE id = ? AND user = ?
|
||||||
""",
|
""",
|
||||||
(thewal, theid),
|
(wallet_id, user_id),
|
||||||
)
|
)
|
||||||
|
|
||||||
next_wallet = db.fetchone("SELECT id FROM wallets WHERE user = ?", (theid,))
|
next_wallet = db.fetchone("SELECT id FROM wallets WHERE user = ?", (user_id,))
|
||||||
if next_wallet:
|
|
||||||
return redirect(url_for("wallet", usr=theid, wal=next_wallet[0]))
|
|
||||||
|
|
||||||
return render_template("index.html")
|
if next_wallet:
|
||||||
|
return redirect(url_for("wallet", usr=user_id, wal=next_wallet[0]))
|
||||||
|
|
||||||
|
return redirect(url_for("home"))
|
||||||
|
|
||||||
|
|
||||||
@app.route("/lnurlwallet")
|
@app.route("/lnurlwallet")
|
||||||
|
|||||||
Reference in New Issue
Block a user