diff --git a/frontend-modern/src/components/Settings/APITokenManager.tsx b/frontend-modern/src/components/Settings/APITokenManager.tsx index dba976cc4..d09e2e1bd 100644 --- a/frontend-modern/src/components/Settings/APITokenManager.tsx +++ b/frontend-modern/src/components/Settings/APITokenManager.tsx @@ -189,7 +189,7 @@ export const APITokenManager: Component = (props) => { setTokensLoaded(true); } catch (err) { logger.error('Failed to load API tokens', err); - showError('Failed to load API tokens'); + notificationStore.error('Failed to load API tokens'); } finally { setLoading(false); } @@ -259,11 +259,11 @@ export const APITokenManager: Component = (props) => { source: 'security', note: 'Copy this token now. You can reopen this dialog from Security → API tokens while this page stays open.', }); - showSuccess('New API token generated. Copy it below while it is still visible.'); + notificationStore.success('New API token generated. Copy it below while it is still visible.'); props.onTokensChanged?.(); } catch (err) { logger.error('Failed to generate API token', err); - showError('Failed to generate API token'); + notificationStore.error('Failed to generate API token'); } finally { setIsGenerating(false); } @@ -327,7 +327,7 @@ export const APITokenManager: Component = (props) => { try { await SecurityAPI.deleteToken(record.id); setTokens((prev) => prev.filter((token) => token.id !== record.id)); - showSuccess('Token revoked', revokeMessage); + notificationStore.success('Token revoked', revokeMessage); props.onTokensChanged?.(); if (affectedDockerHostIds.length > 0) { markDockerHostsTokenRevoked(record.id, affectedDockerHostIds); @@ -343,7 +343,7 @@ export const APITokenManager: Component = (props) => { } } catch (err) { logger.error('Failed to revoke API token', err); - showError('Failed to revoke API token'); + notificationStore.error('Failed to revoke API token'); } }; diff --git a/frontend-modern/src/components/Settings/ChangePasswordModal.tsx b/frontend-modern/src/components/Settings/ChangePasswordModal.tsx index a514b1a03..620ebf77a 100644 --- a/frontend-modern/src/components/Settings/ChangePasswordModal.tsx +++ b/frontend-modern/src/components/Settings/ChangePasswordModal.tsx @@ -1,6 +1,6 @@ import { Component, createSignal, Show } from 'solid-js'; import { Portal } from 'solid-js/web'; -import { showSuccess, showError } from '@/utils/toast'; +import { notificationStore } from '@/stores/notifications'; import { SectionHeader } from '@/components/shared/SectionHeader'; import { formField, labelClass, controlClass, formHelpText } from '@/components/shared/Form'; @@ -75,7 +75,7 @@ export const ChangePasswordModal: Component = (props) throw new Error(text || 'Failed to change password'); } - showSuccess('Password changed successfully. Please log in with your new password.'); + notificationStore.success('Password changed successfully. Please log in with your new password.'); // Clear form setCurrentPassword(''); @@ -92,7 +92,7 @@ export const ChangePasswordModal: Component = (props) } catch (err) { const errorMessage = err instanceof Error ? err.message : 'Failed to change password'; setError(errorMessage); - showError(errorMessage); + notificationStore.error(errorMessage); } finally { setLoading(false); } diff --git a/frontend-modern/src/components/Settings/ProLicensePanel.tsx b/frontend-modern/src/components/Settings/ProLicensePanel.tsx index d3e3e71e5..495f4cf3c 100644 --- a/frontend-modern/src/components/Settings/ProLicensePanel.tsx +++ b/frontend-modern/src/components/Settings/ProLicensePanel.tsx @@ -50,7 +50,7 @@ export const ProLicensePanel: Component = () => { const nextStatus = await LicenseAPI.getStatus(); setStatus(nextStatus); } catch (err) { - showError(err instanceof Error ? err.message : 'Failed to load license status'); + notificationStore.error(err instanceof Error ? err.message : 'Failed to load license status'); } finally { setLoading(false); } @@ -108,17 +108,17 @@ export const ProLicensePanel: Component = () => { const handleActivate = async () => { const trimmedKey = licenseKey().trim(); if (!trimmedKey) { - showError('License key is required'); + notificationStore.error('License key is required'); return; } setActivating(true); try { const result = await LicenseAPI.activateLicense(trimmedKey); if (!result.success) { - showError(result.message || 'Failed to activate license'); + notificationStore.error(result.message || 'Failed to activate license'); return; } - showSuccess(result.message || 'License activated'); + notificationStore.success(result.message || 'License activated'); setLicenseKey(''); if (result.status) { setStatus(result.status); @@ -126,7 +126,7 @@ export const ProLicensePanel: Component = () => { await loadStatus(); } } catch (err) { - showError(err instanceof Error ? err.message : 'Failed to activate license'); + notificationStore.error(err instanceof Error ? err.message : 'Failed to activate license'); } finally { setActivating(false); } @@ -139,10 +139,10 @@ export const ProLicensePanel: Component = () => { setClearing(true); try { const result = await LicenseAPI.clearLicense(); - showSuccess(result.message || 'License cleared'); + notificationStore.success(result.message || 'License cleared'); await loadStatus(); } catch (err) { - showError(err instanceof Error ? err.message : 'Failed to clear license'); + notificationStore.error(err instanceof Error ? err.message : 'Failed to clear license'); } finally { setClearing(false); }