From a679b0b6c6676e8a10ac3ac06d016a9c411c25c6 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 22 Mar 2024 13:22:23 +0300 Subject: [PATCH] apps/web: close message on click --- .../Calculation/Form/ELT/Components/PolicyTable.tsx | 1 + apps/web/apollo/link.js | 5 ++++- apps/web/process/load-kp/reactions.ts | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/web/Components/Calculation/Form/ELT/Components/PolicyTable.tsx b/apps/web/Components/Calculation/Form/ELT/Components/PolicyTable.tsx index 0b90bf4..dbfde3c 100644 --- a/apps/web/Components/Calculation/Form/ELT/Components/PolicyTable.tsx +++ b/apps/web/Components/Calculation/Form/ELT/Components/PolicyTable.tsx @@ -41,6 +41,7 @@ export const PolicyTable = observer( content: 'Выбранный расчет ЭЛТ применен', duration: 1, key: record.key, + onClick: () => message.destroy(record.key), }); $process.delete('ELT'); } diff --git a/apps/web/apollo/link.js b/apps/web/apollo/link.js index fa56d00..7f17dec 100644 --- a/apps/web/apollo/link.js +++ b/apps/web/apollo/link.js @@ -61,6 +61,8 @@ const httpLink = new HttpLink({ uri: URL_CRM_GRAPHQL, }); +const key = 'APOLLO_GRAPHQL'; + const errorLink = onError(({ graphQLErrors, networkError, operation, response }) => { const scope = getCurrentScope(); scope.setTag('operationName', operation.operationName); @@ -68,7 +70,8 @@ const errorLink = onError(({ graphQLErrors, networkError, operation, response }) if (!isServer()) { message.error({ content: `Ошибка во время загрузки данных из CRM`, - key: 'APOLLO_GRAPHQL', + key, + onClick: () => message.destroy(key), }); } diff --git a/apps/web/process/load-kp/reactions.ts b/apps/web/process/load-kp/reactions.ts index 435a865..c0ea19a 100644 --- a/apps/web/process/load-kp/reactions.ts +++ b/apps/web/process/load-kp/reactions.ts @@ -26,6 +26,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) { message.loading({ content: `Загружаем КП ${quote?.label}...`, key, + onClick: () => message.destroy(key), }); const eltInitialValues = await initElt(); @@ -90,12 +91,14 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) { message.success({ content: `КП ${quote.label} загружено`, key, + onClick: () => message.destroy(key), }); }) .catch(() => { message.error({ content: `Ошибка во время загрузки КП ${quote.label}`, key, + onClick: () => message.destroy(key), }); $calculation.element('selectQuote').resetValue(); })