diff --git a/src/app.tsx b/src/app.tsx index a511dc0f..a0a4076e 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -30,6 +30,7 @@ export function App() { handleProviderChange, handleRetryConection, handleProviderLoginLogout, + handleProviderResetAndRefreshList, } = useApp(); const currentProviderId = currentProvider?.id; @@ -126,9 +127,7 @@ export function App() { onSearch={handleSearch} onImport={handleCertificateImportDialogOpen} onCreate={handleCertificateCreateDialogOpen} - onReload={() => - currentProviderId && handleCertificatesDataReload(currentProviderId) - } + onReload={handleProviderResetAndRefreshList} onInfo={() => currentProvider && handleProviderInfoDialogOpen(currentProvider) } diff --git a/src/hooks/app/useApp.tsx b/src/hooks/app/useApp.tsx index 8364014f..76e59040 100644 --- a/src/hooks/app/useApp.tsx +++ b/src/hooks/app/useApp.tsx @@ -223,6 +223,22 @@ export function useApp() { window.location.reload(); }; + const handleProviderResetAndRefreshList = async () => { + if (!fortifyClient.current || !currentProvider) { + return; + } + + try { + const localProvider = await fortifyClient.current.getProviderById( + currentProvider.id + ); + await localProvider.reset(); + } catch (error) { + // + } + handleCertificatesDataReload(currentProvider.id); + }; + const handleProviderLoginLogout = async (isLogedin: boolean) => { if (!fortifyClient.current || !currentProvider) { return; @@ -272,5 +288,6 @@ export function useApp() { handleProviderChange, handleRetryConection, handleProviderLoginLogout, + handleProviderResetAndRefreshList, }; } diff --git a/src/i18n/locales/en/main.json b/src/i18n/locales/en/main.json index 2bc47f55..d54c9ed8 100644 --- a/src/i18n/locales/en/main.json +++ b/src/i18n/locales/en/main.json @@ -203,7 +203,7 @@ "create-certificate-disabled-tooltip": "Please sign in to the provider to add new certificates.", "create-certificate-scr": "Create certificate signing request (CSR)", "create-certificate-ssc": "Create self-signed certificate", - "reload-certificates": "Refresh list", + "reload-certificates": "Reset session and refresh certificate list", "provider-information": "Provider information", "provider-login": "Sign in", "provider-logout": "Sign out",