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