Skip to content

Commit

Permalink
Merge branch 'main' into ahe/discount-api
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewHEguardian authored Dec 14, 2023
2 parents bd3d214 + 4121257 commit bd92664
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 bd92664

Please sign in to comment.