🐛(front) improve domain "return" button

The button to return to domain list was reloading the whole page which
was quite long (and somehow failing on staging).
This commit is contained in:
Quentin BEY
2025-05-14 16:29:41 +02:00
parent bd43e4620d
commit 4f3c9abe62
2 changed files with 8 additions and 1 deletions

View File

@@ -57,6 +57,11 @@ jest.mock('@openfun/cunningham-react', () => ({
}),
}));
jest.mock('next/navigation', () => ({
...jest.requireActual('next/navigation'),
useRouter: () => jest.fn(),
}));
describe('<MailDomainView />', () => {
const apiUrl = `end:/mail-domains/${mockMailDomain.slug}/fetch/`;

View File

@@ -1,4 +1,5 @@
import { Button } from '@openfun/cunningham-react';
import { useRouter } from 'next/navigation';
import * as React from 'react';
import { useTranslation } from 'react-i18next';
@@ -26,6 +27,7 @@ export const MailDomainView = ({
}: Props) => {
const { t } = useTranslation();
const { colorsTokens } = useCunninghamTheme();
const router = useRouter();
const [showModal, setShowModal] = React.useState(false);
const handleShowModal = () => {
@@ -53,7 +55,7 @@ export const MailDomainView = ({
>
<Box $direction="row" $align="center" $gap="8px">
<Button
href="/mail-domains"
onClick={() => router.push('/mail-domains/')}
icon={<span className="material-icons">arrow_back</span>}
iconPosition="left"
color="secondary"