Skip to content

Navbar #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def serialize(self):
"name": self.name,
"email": self.email,
"is_active": self.is_active,
"role": self.role
# "role": self.role
}

class Notes(db.Model):
Expand Down
41 changes: 27 additions & 14 deletions src/api/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,37 @@ def login():

# Protect a route with jwt_required, which will kick out requests
# without a valid JWT present.
@api.route("/profile", methods=["GET"])
# esto de abajo seria el portero de la analogia, entre la ruta y el metodo de autenticación
@jwt_required()
# cuando el corrobora el token entra a la funcion y especifica
def protected():
# Access the identity of the current user with get_jwt_identity
# verifica la identidad ( de quien es el token ) , lo corrobora
current_user = get_jwt_identity()

# con la identidad anterior nosotros hacemos una busqueda

# user = db.session.execute(db.select(User).filter_by(email=current_user)).scalar_one()
# @api.route("/profile", methods=["GET"])

# # esto de abajo seria el portero de la analogia, entre la ruta y el metodo de autenticación
# @jwt_required()
# # cuando el corrobora el token entra a la funcion y especifica
# def protected():
# # Access the identity of the current user with get_jwt_identity
# # verifica la identidad ( de quien es el token ) , lo corrobora
# current_user = get_jwt_identity()

# # con la identidad anterior nosotros hacemos una busqueda

# # user = db.session.execute(db.select(User).filter_by(email=current_user)).scalar_one()

#con la busqueda del señor anterior en la tabla favoritos fijate cuantos tiene y traemelos
# user = db.session.execute(db.select(User).filter_by(email=email)).scalar_one()
# la entidad verificada se guarda en el espacio de memoria
return jsonify(logged_in_as=current_user), 200

# #con la busqueda del señor anterior en la tabla favoritos fijate cuantos tiene y traemelos
# # user = db.session.execute(db.select(User).filter_by(email=email)).scalar_one()
# # la entidad verificada se guarda en el espacio de memoria
# return jsonify(logged_in_as=current_user), 200


@api.route("/verify-token", methods=["GET"])
def verify_token():
try:
verify_jwt_in_request()
identify = get_jwt_identity()
return jsonify({"valid": True, "user": identify}), 200
except NoAuthorizationError:
return jsonify({"valid": False, "message": "Token invalido o no proporcionado"})



Expand Down
55 changes: 38 additions & 17 deletions src/front/js/component/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,48 @@ import logo from "../../img/logo-sin-fondo.jpg"
export const Navbar = () => {
return (
<nav className="navbar navbar-light bg-light p-0">
<div className="container-fluid margintop">
<Link to="/">
<img
src={logo}
className="navbar-brand backnavbar "
style={{ width: "3rem" }}
/>
</Link>
<div className="ml-">
<div className="container-fluid margintop d-flex align-items-center">
<Link to="landingpage">
<img
src={logo}
className="navbar-brand backnavbar"
style={{ width: "3rem" }}
alt="Logo"
/>
</Link>

<ul className="navbar-nav d-flex flex-row w-75 justify-content-center gap-5 fs-5 textcolors">
<li className="nav-item ms-5 me-5 textcolors">
<Link className="nav-link" to="/profile">
Profile
</Link>
</li>
<li className="nav-item ms-5 me-5 textcolors">
<Link className="nav-link" to="/notes">
Notes
</Link>
</li>
<li className="nav-item ms-5 me-5">
<Link className="nav-link" to="/habit-tracker">
Habit-Tracker
</Link>
</li>
<li className="nav-item ms-5 me-5">
<Link className="nav-link" to="/projects">
Projects
</Link>
</li>
</ul>

<div className="ms-auto">
<Link to="/login">
<button className=" w-100 me-5 backbutton border border rounded text-black p-1">Login</button>
<button className="me-5 backbutton border rounded text-black p-1 w-100">
Login
</button>
</Link>
<div className="m-">
<Link to="/landingpage">
<button className=" w-50 me-5 backbutton border border rounded text-black p-1">landingpage</button>
</Link>
</div>
</div>
</div>
<Thememode/>
{/* <Thememode /> */}
</nav>
);
};

2 changes: 1 addition & 1 deletion src/front/js/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//import react into the bundle
import React from "react";
import ReactDOM from "react-dom/client";
import ReactDOM from "react-dom/client"

//include your index.scss file into the bundle
import "../styles/index.css";
Expand Down