diff --git a/src/components/organisms/ApiKey.tsx b/src/components/organisms/ApiKey.tsx index 4e1f93d8..37401954 100644 --- a/src/components/organisms/ApiKey.tsx +++ b/src/components/organisms/ApiKey.tsx @@ -9,7 +9,7 @@ import { Tooltip, CircularProgress, } from '@mui/material'; -import { Visibility, VisibilityOff, ContentCopy } from '@mui/icons-material'; +import { ContentCopy } from '@mui/icons-material'; import styled from 'styled-components'; import axios from 'axios'; import { useGlobalInfoStore } from '../../context/globalInfo'; @@ -31,10 +31,9 @@ const HiddenText = styled(Typography)` font-style: italic; `; -const ApiKey = () => { +const ApiKeyManager = () => { const [apiKey, setApiKey] = useState(null); const [loading, setLoading] = useState(true); - const [showKey, setShowKey] = useState(false); const [copySuccess, setCopySuccess] = useState(false); const { notify } = useGlobalInfoStore(); @@ -44,7 +43,6 @@ const ApiKey = () => { try { const { data } = await axios.get('http://localhost:8080/auth/api-key'); setApiKey(data.api_key); - notify('info', `Fetc API Key: ${data.api_key}`); } catch (error) { console.error('Error fetching API key', error); } finally { @@ -60,7 +58,7 @@ const ApiKey = () => { try { const { data } = await axios.post('http://localhost:8080/auth/generate-api-key'); setApiKey(data.api_key); - notify('info', `Genrate API Key: ${data.api_key}`); + notify('info', `Generated API Key: ${data.api_key}`); } catch (error) { console.error('Error generating API key', error); } finally { @@ -76,10 +74,6 @@ const ApiKey = () => { } }; - const toggleShowKey = () => { - setShowKey(!showKey); - }; - if (loading) return ; return ( @@ -91,29 +85,22 @@ const ApiKey = () => { - - {showKey ? : } + + ), }} /> - - - {copySuccess && ( - - - - )} + {copySuccess && + Copied to Clipboard + } ) : ( <> @@ -127,4 +114,4 @@ const ApiKey = () => { ); }; -export default ApiKey; +export default ApiKeyManager;