diff options
Diffstat (limited to 'api/game/new.py')
-rw-r--r-- | api/game/new.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/api/game/new.py b/api/game/new.py index 8268ea2..5d8d5b7 100644 --- a/api/game/new.py +++ b/api/game/new.py @@ -4,7 +4,7 @@ from db import cursor, connection from socket_io import io from randid import new_uuid from game.socket import games, game -from auth.login_token import token_login +from hierarchy import auth_required def create_game(user_1_id, private = False, user_2_id = None): timestamp = int( time.time() * 1000 ) @@ -34,18 +34,9 @@ def start_game(game_id, user_2_id): new_game = Blueprint('new_game', __name__) @new_game.route('/new', methods = ["GET", "POST"]) -def index(): - data = request.get_json() - - token = request.cookies.get("token") or "" - if not token: - print("a temporary user should be set up here") - - user_id = token_login(token) - if not user_id: return "", 403 - +@auth_required("user") +def index(user_id): game_id = create_game(user_id, True) - return { "id": game_id }, 200 dynamic_route = ["/game", new_game] |