From c058d765dbfe23bda01c1ce50efec01a94898270 Mon Sep 17 00:00:00 2001 From: Patrick Sulzle Date: Fri, 11 Mar 2022 15:17:42 +0100 Subject: [PATCH] All routing logic in app.py are working correctly. --- frontend/app.py | 14 ++++++++++++-- frontend/templates/index.html | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/frontend/app.py b/frontend/app.py index 5d7059c..69b0b59 100644 --- a/frontend/app.py +++ b/frontend/app.py @@ -2,9 +2,16 @@ from flask import Flask, request, render_template, url_for, redirect app = Flask(__name__) -@app.route("/") +@app.route("/", methods=['GET', 'POST']) def groclist_home(): - return render_template('index.html') + error = None + if request.method == 'POST': + if request.form.get('login') == 'Inloggen': + return redirect(url_for('groclist_login')) + elif request.method == 'GET': + return render_template('index.html') + + return render_template('index.html',error=error) @app.route("/welcome") def groclist_welcome(): @@ -20,6 +27,9 @@ def groclist_login(): return redirect(url_for('groclist_welcome')) return render_template("login.html", error=error) + +app.add_url_rule("/welcome", "welcome", groclist_welcome) + # start server with run method if __name__ == "__main__": app.run(debug=True) diff --git a/frontend/templates/index.html b/frontend/templates/index.html index bed8f0f..e64d639 100644 --- a/frontend/templates/index.html +++ b/frontend/templates/index.html @@ -11,4 +11,7 @@

Welkom bij Groclist

+
+ +
{% endblock %}