Skip to content

Commit

Permalink
Fix reload provider
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandr-slobodian committed Oct 1, 2024
1 parent 52403df commit 687297f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function App() {
handleProviderChange,
handleRetryConection,
handleProviderLoginLogout,
handleProviderResetAndRefreshList,
} = useApp();

const currentProviderId = currentProvider?.id;
Expand Down Expand Up @@ -126,9 +127,7 @@ export function App() {
onSearch={handleSearch}
onImport={handleCertificateImportDialogOpen}
onCreate={handleCertificateCreateDialogOpen}
onReload={() =>
currentProviderId && handleCertificatesDataReload(currentProviderId)
}
onReload={handleProviderResetAndRefreshList}
onInfo={() =>
currentProvider && handleProviderInfoDialogOpen(currentProvider)
}
Expand Down
17 changes: 17 additions & 0 deletions src/hooks/app/useApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -272,5 +288,6 @@ export function useApp() {
handleProviderChange,
handleRetryConection,
handleProviderLoginLogout,
handleProviderResetAndRefreshList,
};
}
2 changes: 1 addition & 1 deletion src/i18n/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 687297f

Please sign in to comment.