Skip to content

Commit

Permalink
Merge pull request #209 from IFRCGo/fix/permalink-redirect
Browse files Browse the repository at this point in the history
Fix redirect issue
  • Loading branch information
roshni73 authored Dec 17, 2024
2 parents 9894348 + c1e84ec commit 99503a6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/App/redirects/UnsubscribeRedirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ export function Component() {
const { subscriptionId, token } = useParams<UnsubscribeParams>();
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;
Expand Down
4 changes: 2 additions & 2 deletions src/App/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions src/views/NewSubscriptionModal/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
4 changes: 3 additions & 1 deletion src/views/NewSubscriptionModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,9 @@ function NewSubscriptionModal(props: Props) {
onClick={handleFormSubmit}
disabled={pristine || loadingSubscription}
>
{strings.createNewSubscription}
{(isDefined(subscription?.id)
? strings.updateSubscription : strings.createNewSubscription
)}
</Button>
)}
footerContentClassName={styles.createButton}
Expand Down

0 comments on commit 99503a6

Please sign in to comment.