Refresh domains for latest status

This commit is contained in:
Owen
2026-04-20 14:57:24 -07:00
parent 2dad97cb6b
commit 9a6408d28c
6 changed files with 198 additions and 81 deletions

View File

@@ -12,11 +12,13 @@ import { useTranslations } from "next-intl";
interface RestartDomainButtonProps {
orgId: string;
domainId: string;
onSuccess?: () => void;
}
export default function RestartDomainButton({
orgId,
domainId
domainId,
onSuccess
}: RestartDomainButtonProps) {
const router = useRouter();
const api = createApiClient(useEnvContext());
@@ -35,7 +37,11 @@ export default function RestartDomainButton({
});
// Wait a bit before refreshing to allow the restart to take effect
await new Promise((resolve) => setTimeout(resolve, 200));
router.refresh();
if (onSuccess) {
onSuccess();
} else {
router.refresh();
}
} catch (e) {
toast({
title: t("error"),