From c1e84eca3ab18d610bb4ca553bc2cc8338cc9a07 Mon Sep 17 00:00:00 2001 From: barshathakuri Date: Tue, 17 Dec 2024 16:31:51 +0545 Subject: [PATCH] Fix redirect issue --- src/App/redirects/UnsubscribeRedirect.tsx | 6 +++--- src/App/routes/index.tsx | 4 ++-- src/views/NewSubscriptionModal/i18n.json | 5 +++-- src/views/NewSubscriptionModal/index.tsx | 4 +++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/App/redirects/UnsubscribeRedirect.tsx b/src/App/redirects/UnsubscribeRedirect.tsx index 174ea9f..8c96d05 100644 --- a/src/App/redirects/UnsubscribeRedirect.tsx +++ b/src/App/redirects/UnsubscribeRedirect.tsx @@ -17,13 +17,13 @@ export function Component() { const { subscriptionId, token } = useParams(); const navigate = useNavigate(); - const UnsubscribeLink = (subscriptionId && token) ? ({ + const unsubscribeLink = (subscriptionId && token) ? ({ pathname: (generatePath(routes.unsubscribe.absolutePath, { subscriptionId, token })), }) : routes.pageNotFound.path; - if (UnsubscribeLink) { - navigate(UnsubscribeLink); + if (unsubscribeLink) { + navigate(unsubscribeLink); } return null; diff --git a/src/App/routes/index.tsx b/src/App/routes/index.tsx index 80b19b0..5514fd1 100644 --- a/src/App/routes/index.tsx +++ b/src/App/routes/index.tsx @@ -358,7 +358,7 @@ const unsubscribe = customWrapRoute({ parent: rootLayout, path: 'unsubscribe/:subscriptionId/:token', component: { - render: () => import('#views/Unsubscribe/index.tsx'), + render: () => import('#views/Unsubscribe'), props: {}, }, wrapperComponent: Auth, @@ -372,7 +372,7 @@ const unsubscribeRedirect = customWrapRoute({ parent: rootLayout, path: 'permalink/unsubscribe-user-alert-subscription/:subscriptionId/:token', component: { - render: () => import('../redirects/UnsubscribeRedirect.tsx'), + render: () => import('../redirects/UnsubscribeRedirect'), props: {}, }, wrapperComponent: Auth, diff --git a/src/views/NewSubscriptionModal/i18n.json b/src/views/NewSubscriptionModal/i18n.json index fe81aa2..b5e3e3d 100644 --- a/src/views/NewSubscriptionModal/i18n.json +++ b/src/views/NewSubscriptionModal/i18n.json @@ -23,6 +23,7 @@ "newSubscriptionCreatedSuccessfully": "Subscription created successfully.", "newSubscriptionFailed": "Failed to create subscription", "subscriptionUpdatedSuccessfully": "Subscription updated successfully.", - "failedToUpdateSubscription": "Failed to update subscription." + "failedToUpdateSubscription": "Failed to update subscription.", + "updateSubscription": "Update" } -} +} \ No newline at end of file diff --git a/src/views/NewSubscriptionModal/index.tsx b/src/views/NewSubscriptionModal/index.tsx index 3af7e94..b933e6d 100644 --- a/src/views/NewSubscriptionModal/index.tsx +++ b/src/views/NewSubscriptionModal/index.tsx @@ -469,7 +469,9 @@ function NewSubscriptionModal(props: Props) { onClick={handleFormSubmit} disabled={pristine || loadingSubscription} > - {strings.createNewSubscription} + {(isDefined(subscription?.id) + ? strings.updateSubscription : strings.createNewSubscription + )} )} footerContentClassName={styles.createButton}