modified: app.py
This commit is contained in:
12
app.py
12
app.py
@@ -113,9 +113,19 @@ def callback():
|
|||||||
|
|
||||||
@app.route("/playlists")
|
@app.route("/playlists")
|
||||||
def playlists():
|
def playlists():
|
||||||
|
# Sicherstellen, dass der Benutzer eingeloggt ist und ein gültiges Token vorhanden ist
|
||||||
|
token_info = session.get('token_info', None)
|
||||||
|
if not token_info:
|
||||||
|
return redirect('/login')
|
||||||
|
|
||||||
sp = get_spotify_client()
|
sp = get_spotify_client()
|
||||||
|
if not sp:
|
||||||
|
return redirect('/login')
|
||||||
|
|
||||||
playlists = sp.current_user_playlists()["items"]
|
playlists = sp.current_user_playlists()["items"]
|
||||||
return render_template("playlists.html", playlists=playlists, translations=get_translations())
|
user = session.get('user')
|
||||||
|
access_token = token_info.get('access_token')
|
||||||
|
return render_template("playlists.html", playlists=playlists, translations=get_translations(), user=user, access_token=access_token)
|
||||||
|
|
||||||
@app.route("/quiz/<playlist_id>")
|
@app.route("/quiz/<playlist_id>")
|
||||||
def quiz(playlist_id):
|
def quiz(playlist_id):
|
||||||
|
|||||||
Reference in New Issue
Block a user