From 2a4cbbbe4a96abe0018c06c29765670bfc4f6790 Mon Sep 17 00:00:00 2001 From: Vedant Shankar Bhavsar Date: Sun, 11 Aug 2024 19:38:18 +0530 Subject: [PATCH 1/2] Update apikey-modal.tsx --- components/modals/apikey-modal.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/modals/apikey-modal.tsx b/components/modals/apikey-modal.tsx index fe1af43..d96c7e3 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: "Something went wrong", + description: "Please Enter API Key.", + variant: "destructive", + }); + return; + } + // Save API key to cookies document.cookie = serialize('openaiApiKey', apiKey, { path: '/' }); toast({ From b6f40e5eb792a44dc29dfe4ce518b11f8718ff19 Mon Sep 17 00:00:00 2001 From: Vedant Shankar Bhavsar Date: Sat, 24 Aug 2024 13:31:33 +0000 Subject: [PATCH 2/2] change toast message --- components/modals/apikey-modal.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/modals/apikey-modal.tsx b/components/modals/apikey-modal.tsx index d96c7e3..430e7fa 100644 --- a/components/modals/apikey-modal.tsx +++ b/components/modals/apikey-modal.tsx @@ -33,16 +33,16 @@ const ApiKeyModal = () => { } const handleSave = () => { - // Check API key is not null + // Check API key is not null if (!apiKey) { toast({ - title: "Something went wrong", - description: "Please Enter API Key.", + 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({