Skip to content

Commit

Permalink
Merge pull request #2 from VedantBhawsar/fix-api-dialog-box
Browse files Browse the repository at this point in the history
Fix API Key Dialog Box Behavior to Prevent Auto-Close on Empty
  • Loading branch information
Supernova3339 authored Aug 25, 2024
2 parents 702faa5 + b6f40e5 commit b756d0a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/modals/apikey-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ const ApiKeyModal = () => {
}

const handleSave = () => {
// Check API key is not null
if (!apiKey) {
toast({
title: "API Key Required",
description: "Please enter a valid API key to continue.",
variant: "destructive",
});
return;
}

// Save API key to cookies
document.cookie = serialize('openaiApiKey', apiKey, { path: '/' });
toast({
Expand Down

0 comments on commit b756d0a

Please sign in to comment.