diff options
author | Sebastian <sebasjm@gmail.com> | 2024-08-27 19:01:57 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-08-27 19:01:57 -0300 |
commit | ca4bccc5de2d92333267ced69535d4400c394fb9 (patch) | |
tree | 4c53d12734aabc4863f57d9820b482052d63c127 /packages/aml-backoffice-ui/src/App.tsx | |
parent | 94cb658024a17084da5de310bc5104cff6fd8337 (diff) | |
download | wallet-core-ca4bccc5de2d92333267ced69535d4400c394fb9.tar.xz |
refresh decisions history when the auditor makes decision
Diffstat (limited to 'packages/aml-backoffice-ui/src/App.tsx')
-rw-r--r-- | packages/aml-backoffice-ui/src/App.tsx | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/packages/aml-backoffice-ui/src/App.tsx b/packages/aml-backoffice-ui/src/App.tsx index 0b66e0d26..d2cb2fd62 100644 --- a/packages/aml-backoffice-ui/src/App.tsx +++ b/packages/aml-backoffice-ui/src/App.tsx @@ -13,7 +13,12 @@ You should have received a copy of the GNU General Public License along with GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { canonicalizeBaseUrl } from "@gnu-taler/taler-util"; +import { + CacheEvictor, + TalerExchangeCacheEviction, + assertUnreachable, + canonicalizeBaseUrl, +} from "@gnu-taler/taler-util"; import { BrowserHashNavigationProvider, ExchangeApiProvider, @@ -31,6 +36,8 @@ import { strings } from "./i18n/strings.js"; import "./scss/main.css"; import { UiSettings, fetchUiSettings } from "./context/ui-settings.js"; import { UiFormsProvider, fetchUiForms } from "./context/ui-forms.js"; +import { revalidateAccountDecisions } from "./hooks/decisions.js"; +import { revalidateAccountInformation } from "./hooks/account.js"; const WITH_LOCAL_STORAGE_CACHE = false; @@ -56,6 +63,9 @@ export function App(): VNode { <ExchangeApiProvider baseUrl={new URL("/", baseUrl)} frameOnError={ExchangeAmlFrame} + evictors={{ + exchange: evictExchangeSwrCache, + }} > <SWRConfig value={{ @@ -136,3 +146,22 @@ function getInitialBackendBaseURL( return canonicalizeBaseUrl(window.origin); } } + +const evictExchangeSwrCache: CacheEvictor<TalerExchangeCacheEviction> = { + async notifySuccess(op) { + switch (op) { + case TalerExchangeCacheEviction.MAKE_AML_DECISION: { + await revalidateAccountDecisions(); + await revalidateAccountInformation(); + return; + } + case TalerExchangeCacheEviction.CREATE_DESCISION: + case TalerExchangeCacheEviction.UPLOAD_KYC_FORM: { + return; + } + default: { + assertUnreachable(op); + } + } + }, +}; |