AxL95 commited on
Commit
4d3a6e7
·
verified ·
1 Parent(s): 7ddd2ca

Update frontend/src/components/Panel.jsx

Browse files
Files changed (1) hide show
  1. frontend/src/components/Panel.jsx +11 -3
frontend/src/components/Panel.jsx CHANGED
@@ -80,9 +80,17 @@ const Panel = ({
80
  <span className="username">{userName}</span>
81
  {userRole === "Administrateur" && (
82
  <button
83
- onClick={() => setPage("Administrateur")}
84
- className="admin-btn"
85
- >
 
 
 
 
 
 
 
 
86
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#4CAF50" viewBox="0 0 16 16">
87
  <path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z"/>
88
  </svg>
 
80
  <span className="username">{userName}</span>
81
  {userRole === "Administrateur" && (
82
  <button
83
+ onClick={() => {
84
+ if (typeof setPage === 'function') {
85
+ setPage("Administrateur");
86
+ } else {
87
+ console.error("setPage n'est pas une fonction:", setPage);
88
+ // Alternative pour éviter le blocage
89
+ window.location.href = window.location.href.split("?")[0] + "?page=admin";
90
+ }
91
+ }}
92
+ className="admin-btn"
93
+ >
94
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#4CAF50" viewBox="0 0 16 16">
95
  <path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z"/>
96
  </svg>