From 46d19fedcb548419a2d57224cf006a6059ba23b1 Mon Sep 17 00:00:00 2001
From: Lucie Bader <167515375+Lucie-Bdr@users.noreply.github.com>
Date: Thu, 20 Feb 2025 17:35:55 +0100
Subject: [PATCH] =?UTF-8?q?Correction=20d=C3=A9connexion=20menu=20contextu?=
 =?UTF-8?q?el=20navigateur?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/context_menu/browser_context_menu.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/context_menu/browser_context_menu.js b/src/context_menu/browser_context_menu.js
index 57f5d56..b529bb6 100644
--- a/src/context_menu/browser_context_menu.js
+++ b/src/context_menu/browser_context_menu.js
@@ -97,10 +97,14 @@ browser.contextMenus.onClicked.addListener(async (info, tab) => {
   // Action pour le bouton de connexion/déconnexion
   if (info.menuItemId === "login") {
     log("🔄 Action login/déconnexion demandée.");
-    if (typeof actuallyOpenLoginPage === "function") {
-      actuallyOpenLoginPage();
+    if (authToken) {
+      await disconnectFromLexicalDB();
     } else {
-      log("La fonction actuallyOpenLoginPage n'est pas accessible.");
+      if (typeof actuallyOpenLoginPage === "function") {
+        actuallyOpenLoginPage();
+      } else {
+        log("La fonction actuallyOpenLoginPage n'est pas accessible.");
+      }
     }
     return;
   }
-- 
GitLab