Checkpoint: Ajout du bouton "Vérifier maintenant" pour forcer une vérification immédiate des emails sans attendre le prochain cycle automatique.
This commit is contained in:
@@ -16,6 +16,8 @@ export default function ImportSettings() {
|
||||
const updateMutation = trpc.importSettings.update.useMutation();
|
||||
const startEmailServiceMutation = trpc.emailImportService.start.useMutation();
|
||||
const stopEmailServiceMutation = trpc.emailImportService.stop.useMutation();
|
||||
const checkNowEmailMutation = trpc.emailImportService.checkNow.useMutation();
|
||||
const utils = trpc.useUtils();
|
||||
const startFolderServiceMutation = trpc.folderImportService.start.useMutation();
|
||||
const stopFolderServiceMutation = trpc.folderImportService.stop.useMutation();
|
||||
|
||||
@@ -413,6 +415,42 @@ export default function ImportSettings() {
|
||||
Service actif
|
||||
</span>
|
||||
)}
|
||||
|
||||
{emailServiceStatus?.isRunning && (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={async () => {
|
||||
try {
|
||||
toast.info("V\u00e9rification en cours...", {
|
||||
description: "Connexion au serveur IMAP et recherche de nouveaux emails.",
|
||||
});
|
||||
const result = await checkNowEmailMutation.mutateAsync();
|
||||
if (result.success) {
|
||||
await utils.importLogs.getByUser.invalidate();
|
||||
toast.success("V\u00e9rification termin\u00e9e", {
|
||||
description: result.message,
|
||||
});
|
||||
} else {
|
||||
toast.error("Erreur", {
|
||||
description: result.message,
|
||||
});
|
||||
}
|
||||
} catch (error: any) {
|
||||
toast.error("Erreur", {
|
||||
description: error.message || "Impossible de v\u00e9rifier les emails.",
|
||||
});
|
||||
}
|
||||
}}
|
||||
disabled={checkNowEmailMutation.isPending}
|
||||
>
|
||||
{checkNowEmailMutation.isPending ? (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||
) : (
|
||||
<Mail className="mr-2 h-4 w-4" />
|
||||
)}
|
||||
V\u00e9rifier maintenant
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user