@wraps(f)
def decorated(*args, **kwargs):
    token = request.headers['token']
    if (not token):
        return (jsonify({'error': 'Token no existe'}), 403)
    try:
        data = jwt.decode(token, app.config['SECRET_KEY'])
        current_user = Usuario.query.filter_by(nick=data['nick']).first()
        current_user = data['nick']
    except:
        return (jsonify({'error': 'Token no valido'}), 403)
    return f(current_user, *args, **kwargs)
@wraps(f)
def decorated(*args, **kwargs):
    token = request.headers['token']
    if (not token):
        return (jsonify({'error': 'Token no existe'}), 403)
    try:
        data = jwt.decode(token, app.config['SECRET_KEY'])
        current_user = Usuario.query.filter_by(nick=data['nick']).first()
        current_user = data['nick']
    except:
        return (jsonify({'error': 'Token no valido'}), 403)
    return f(current_user, *args, **kwargs)