get member status from localstorage

This commit is contained in:
qcrao
2024-07-10 16:09:36 +08:00
parent bbd81750c9
commit 416fd30d59

View File

@@ -34,10 +34,15 @@ function initializeButtons() {
} }
async function checkMembershipStatus() { async function checkMembershipStatus() {
const storageKey = "BulkDeleteChatGPT_isPaid";
const localIsPaid = localStorage.getItem(storageKey) === "true";
updateBulkArchiveButton(localIsPaid);
const userInfo = await getUserInfo(); const userInfo = await getUserInfo();
if (!userInfo) { if (!userInfo) {
console.error("Unable to get user info"); console.error("Unable to get user info");
updateBulkArchiveButton(false);
return; return;
} }
@@ -48,10 +53,12 @@ async function checkMembershipStatus() {
)}` )}`
); );
const data = await response.json(); const data = await response.json();
// 更新本地存储和按钮状态
localStorage.setItem(storageKey, data.isPaid);
updateBulkArchiveButton(data.isPaid); updateBulkArchiveButton(data.isPaid);
} catch (error) { } catch (error) {
console.error("Error checking membership status:", error); console.error("Error checking membership status:", error);
updateBulkArchiveButton(false);
} }
} }