MCPcopy Create free account
hub / github.com/EyuCoder/chatgpt-pro / saveKey

Function saveKey

src/components/Setting.jsx:12–30  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

10 const [input, setInput] = useState('');
11
12 const saveKey = async (e) => {
13 e.preventDefault();
14 setLoading(true);
15 setErrorMsg('');
16 const keys = input;
17
18 await checkApiKey(keys)
19 .then(() => {
20 window.localStorage.setItem('api-key', keys);
21 console.log('works');
22 setModalOpen(false);
23 })
24 .catch(() => {
25 console.log('doesnt work');
26 setErrorMsg('error: incorrect keys');
27 });
28
29 setLoading(false);
30 };
31
32 const removeApiKey = () => {
33 window.localStorage.removeItem('api-key');

Callers

nothing calls this directly

Calls 1

checkApiKeyFunction · 0.90

Tested by

no test coverage detected