From 416fd30d59ee802c2dc641528ab9adc28d501385 Mon Sep 17 00:00:00 2001 From: qcrao Date: Wed, 10 Jul 2024 16:09:36 +0800 Subject: [PATCH] get member status from localstorage --- popup.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/popup.js b/popup.js index 57aee50..17d1b08 100644 --- a/popup.js +++ b/popup.js @@ -34,10 +34,15 @@ function initializeButtons() { } async function checkMembershipStatus() { + const storageKey = "BulkDeleteChatGPT_isPaid"; + + const localIsPaid = localStorage.getItem(storageKey) === "true"; + + updateBulkArchiveButton(localIsPaid); + const userInfo = await getUserInfo(); if (!userInfo) { console.error("Unable to get user info"); - updateBulkArchiveButton(false); return; } @@ -48,10 +53,12 @@ async function checkMembershipStatus() { )}` ); const data = await response.json(); + + // 更新本地存储和按钮状态 + localStorage.setItem(storageKey, data.isPaid); updateBulkArchiveButton(data.isPaid); } catch (error) { console.error("Error checking membership status:", error); - updateBulkArchiveButton(false); } }