diff --git a/components/modals/apikey-modal.tsx b/components/modals/apikey-modal.tsx index fe1af43..430e7fa 100644 --- a/components/modals/apikey-modal.tsx +++ b/components/modals/apikey-modal.tsx @@ -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({