feat: notify errors
This commit is contained in:
@@ -40,8 +40,8 @@ const ApiKeyManager = () => {
|
|||||||
try {
|
try {
|
||||||
const { data } = await axios.get('http://localhost:8080/auth/api-key');
|
const { data } = await axios.get('http://localhost:8080/auth/api-key');
|
||||||
setApiKey(data.api_key);
|
setApiKey(data.api_key);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
console.error('Error fetching API key', error);
|
notify('error', `Failed to fetch API Key - ${error.message}`);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -56,8 +56,8 @@ const ApiKeyManager = () => {
|
|||||||
const { data } = await axios.post('http://localhost:8080/auth/generate-api-key');
|
const { data } = await axios.post('http://localhost:8080/auth/generate-api-key');
|
||||||
setApiKey(data.api_key);
|
setApiKey(data.api_key);
|
||||||
notify('success', `Generated API Key successfully`);
|
notify('success', `Generated API Key successfully`);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
console.error('Error generating API key', error);
|
notify('error', `Failed to generate API Key - ${error.message}`);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -69,8 +69,8 @@ const ApiKeyManager = () => {
|
|||||||
await axios.delete('http://localhost:8080/auth/delete-api-key');
|
await axios.delete('http://localhost:8080/auth/delete-api-key');
|
||||||
setApiKey(null);
|
setApiKey(null);
|
||||||
notify('success', 'API Key deleted successfully');
|
notify('success', 'API Key deleted successfully');
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
console.error('Error deleting API key', error);
|
notify('error', `Failed to delete API Key - ${error.message}`);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user