🐛(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:
@@ -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/`;
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user