From a06ae82aff12e666ee059f9c886105b8e63d22fc Mon Sep 17 00:00:00 2001 From: josc146 Date: Thu, 27 Apr 2023 23:03:05 +0800 Subject: [PATCH] chore --- src/background/index.mjs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/background/index.mjs b/src/background/index.mjs index 17bb5e17..913e8c2b 100644 --- a/src/background/index.mjs +++ b/src/background/index.mjs @@ -100,23 +100,24 @@ async function executeApi(session, port, config) { } Browser.runtime.onMessage.addListener(async (message) => { - let token switch (message.type) { - case 'FEEDBACK': - token = await getChatGptAccessToken() + case 'FEEDBACK': { + const token = await getChatGptAccessToken() await sendMessageFeedback(token, message.data) break - case 'DELETE_CONVERSATION': - token = await getChatGptAccessToken() + } + case 'DELETE_CONVERSATION': { + const token = await getChatGptAccessToken() await deleteConversation(token, message.data.conversationId) break + } case 'OPEN_URL': openUrl(message.data.url) break case 'REFRESH_MENU': refreshMenu() break - case 'PIN_TAB': + case 'PIN_TAB': { let tabId if (message.data.tabId) tabId = message.data.tabId else { @@ -132,6 +133,7 @@ Browser.runtime.onMessage.addListener(async (message) => { if (message.data.saveAsChatgptConfig) await setUserConfig({ chatgptTabId: tabId }) } break + } } })