From a0318f76f40deaeba367badf18af6141325d29e9 Mon Sep 17 00:00:00 2001
From: HombreLaser <sebastian-440@live.com>
Date: Thu, 25 May 2023 19:53:48 -0600
Subject: Añade redirecciones faltantes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/components/user_account_dropdown_menu.tsx | 45 ++++++++++++++++++---------
 1 file changed, 30 insertions(+), 15 deletions(-)

(limited to 'src/components/user_account_dropdown_menu.tsx')

diff --git a/src/components/user_account_dropdown_menu.tsx b/src/components/user_account_dropdown_menu.tsx
index 495f3c8..2bd0d28 100644
--- a/src/components/user_account_dropdown_menu.tsx
+++ b/src/components/user_account_dropdown_menu.tsx
@@ -1,22 +1,37 @@
 import { PersonFill, DoorOpenFill, CardList } from "react-bootstrap-icons";
+import { BrowserRouter, Form } from "react-router-dom";
+import RedirectTo from '../lib/redirect_to';
+import Token from "../lib/token";
+import redirectTo from "../lib/redirect_to";
 
 export default function UserAccountDropdownMenu() {
+  function logout() {
+    const token = new Token();
+    token.logout();
+    
+    redirectTo('/products');
+  }
+
   return(
-    <div id="userAccountDropdownMenu" className="hidden bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-gray-700 dark:divide-gray-600">
-      <ul className="relative py-2 text-sm text-gray-700 dark:text-gray-200">
-        <li className="flex">
-          <i className="px-1 my-2"><PersonFill size={16} color="#394490"/></i>
-          <a href="/account" className="block px-2 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">Cuenta</a>
-        </li>
-        <li className="flex">
-          <i className="px-1 my-2"><CardList size={16} color="#394490"/></i>
-          <a href="/account/orders" className="block px-2 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">Historial de órdenes</a>
-        </li>
-      </ul>
-      <div className="flex py-2">
-       <i className="px-1 my-2"><DoorOpenFill size={16} color="#394490"/></i> 
-        <a href="#" className="flex block px-2 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">Cerrar sesión</a>
+    <BrowserRouter>
+      <div id="userAccountDropdownMenu" className="hidden bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-gray-700 dark:divide-gray-600">
+        <ul className="relative py-2 text-sm text-gray-700 dark:text-gray-200">
+          <li className="flex">
+            <i className="px-1 my-2"><PersonFill size={16} color="#394490"/></i>
+            <a href="/account" className="block px-2 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">Cuenta</a>
+          </li>
+          <li className="flex">
+            <i className="px-1 my-2"><CardList size={16} color="#394490"/></i>
+            <a href="/account/orders" className="block px-2 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">Historial de órdenes</a>
+          </li>
+        </ul>
+        <div className="flex py-2">
+        <i className="px-1 my-2"><DoorOpenFill size={16} color="#394490"/></i>
+        <button type="button" onClick={logout} className="flex block px-2 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">
+          Cerrar sesión
+        </button>
+        </div>
       </div>
-    </div>
+    </BrowserRouter>
   );
 }
\ No newline at end of file
-- 
cgit v1.2.3

