Skip to content

Commit

Permalink
Merge branch 'ahe/discount-api' of https://github.com/guardian/manage…
Browse files Browse the repository at this point in the history
…-frontend into ahe/discount-api
  • Loading branch information
andrewHEguardian committed Dec 14, 2023
2 parents ffceac9 + bd92664 commit f43708d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
SvgClock,
SvgCreditCard,
} from '@guardian/source-react-components';
import { Navigate, useLocation, useNavigate } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router-dom';
import { PageContainer } from '@/client/components/mma/Page';
import { ErrorIcon } from '@/client/components/mma/shared/assets/ErrorIcon';
import { JsonResponseHandler } from '@/client/components/mma/shared/asyncComponents/DefaultApiResponseHandler';
Expand Down Expand Up @@ -275,6 +275,8 @@ interface ManageProductV2RouterState {
}

const AsyncLoadedInnerContent = (props: WithProductType<ProductType>) => {
const navigate = useNavigate();

const request = createProductDetailFetcher(
props.productType.allProductsProductTypeFilterString,
);
Expand All @@ -292,7 +294,8 @@ const AsyncLoadedInnerContent = (props: WithProductType<ProductType>) => {
}

if (data == null || data.products.length == 0) {
return <Navigate to="/" />;
navigate('/');
return null;
}

const productDetail = data.products.filter(isProduct)[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export const SelectReason = () => {
const canContinue = !!selectedReasonId.length;
if (canContinue) {
await postReason();
navigate(navigateToReminder ? '../reminder' : './', {
navigate(navigateToReminder ? '../reminder' : '/', {
state: {
selectedReasonId,
},
Expand Down

0 comments on commit f43708d

Please sign in to comment.