-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #210 from IFRCGo/feature/subscription-redirect
Fix subscription redirect issue
- Loading branch information
Showing
9 changed files
with
87 additions
and
96 deletions.
There are no files selected for viewing
Submodule backend
updated
30 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { | ||
generatePath, | ||
useNavigate, | ||
useParams, | ||
} from 'react-router-dom'; | ||
|
||
import routes from '#routes'; | ||
|
||
interface SubscriptionDetailsParams { | ||
subscriptionId: string | undefined; | ||
[key: string]: string | undefined; | ||
} | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export function Component() { | ||
const { subscriptionId } = useParams<SubscriptionDetailsParams>(); | ||
const navigate = useNavigate(); | ||
|
||
const subscriptionDetailsLink = (subscriptionId) ? ({ | ||
pathname: (generatePath( | ||
routes.subscriptionDetail.absolutePath, | ||
{ subscriptionId }, | ||
)), | ||
}) | ||
: routes.pageNotFound.path; | ||
|
||
if (subscriptionDetailsLink) { | ||
navigate(subscriptionDetailsLink); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
Component.displayName = 'SubscriptionDetailsRedirect'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters