(e)
| 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'); |
nothing calls this directly
no test coverage detected