blob: 4ee48bfc67b1b3832d7538364fb1164c2a5fc73e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
from flask import Blueprint, request
from db import cursor
from auth.login_token import token_login
preferences = Blueprint('preferences', __name__)
@preferences.route('/preferences')
def index():
data = request.get_json()
token = request.cookies.get("token") or ""
if not token: return "", 401
login = token_login(token) or ""
if not login: return "", 403
user_prefs = cursor.execute("select preferences from users where user_id = ?", [login]).fetchone()
return { "preferences": user_prefs[0] }, 200
dynamic_route = ["/user", preferences]
|