Skip to content

Commit

Permalink
Wrong use of AND instead of OR
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Veenhof authored and krlvi committed Apr 4, 2023
1 parent 52715ec commit 94f7268
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ async function getApiKey() {
let options = await new Promise((resolve) => {
chrome.storage.sync.get('openai_apikey', resolve);
});
if (!options && !options['openai_apikey']) {
console.log(options);
if (!options || !options['openai_apikey']) {
throw new Error("UNAUTHORIZED");
}
return options['openai_apikey'];
Expand All @@ -57,6 +58,8 @@ async function callChatGPT(messages, callback, onDone) {
apiKey = await getApiKey();
} catch (e) {
callback('Please add your Open AI API key to the settings of this Chrome Extension.');
onDone();
return;
}

const api = new ChatGPTAPI({
Expand Down

0 comments on commit 94f7268

Please sign in to comment.