💄(domains) improve user experience and avoid repeat fix operations

Adds a loader after clicking on "Re-run check" for a domain
This commit is contained in:
Laurent Bossavit
2025-03-03 16:08:53 +01:00
committed by Sabrina Demagny
parent 8b56d97037
commit 4060006a22
2 changed files with 24 additions and 19 deletions

View File

@@ -14,6 +14,7 @@ and this project adheres to
### Fixed
- 💄(domains) improve user experience and avoid repeat fix_domain operations
- 👽️(dimail) increase timeout value for check domain API call
- 🧱(helm) add resource-server ingress path #743
- 🌐(backend) synchronize translations with crowdin again

View File

@@ -1,5 +1,6 @@
import {
Button,
Loader,
Modal,
ModalSize,
VariantType,
@@ -62,18 +63,17 @@ export const MailDomainView = ({ mailDomain, onMailDomainUpdate }: Props) => {
toast(t('copy done'), VariantType.SUCCESS);
};
const { mutate: fetchMailDomain } = useFetchFromDimail({
onSuccess: (data: MailDomain) => {
console.info('fetchMailDomain success', data);
setShowModal(false);
toast(t('Domain data fetched successfully'), VariantType.SUCCESS);
onMailDomainUpdate?.(data);
},
onError: () => {
console.error('fetchMailDomain error');
toast(t('Failed to fetch domain data'), VariantType.ERROR);
},
});
const { mutate: fetchMailDomain, isPending: fetchPending } =
useFetchFromDimail({
onSuccess: (data: MailDomain) => {
setShowModal(false);
toast(t('Domain data fetched successfully'), VariantType.SUCCESS);
onMailDomainUpdate?.(data);
},
onError: () => {
toast(t('Failed to fetch domain data'), VariantType.ERROR);
},
});
return (
<>
@@ -155,13 +155,17 @@ export const MailDomainView = ({ mailDomain, onMailDomainUpdate }: Props) => {
)}
<pre>
<div style={{ display: 'flex', justifyContent: 'center' }}>
<Button
onClick={() => {
void fetchMailDomain(mailDomain.slug);
}}
>
{t('Re-run check')}
</Button>
{fetchPending ? (
<Loader />
) : (
<Button
onClick={() => {
void fetchMailDomain(mailDomain.slug);
}}
>
{t('Re-run check')}
</Button>
)}
</div>
</pre>
</Modal>