mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-17 06:24:32 +00:00
improve cert status style
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { RotateCw } from "lucide-react";
|
import { Loader2, RotateCw } from "lucide-react";
|
||||||
import { useCertificate } from "@app/hooks/useCertificate";
|
import { useCertificate } from "@app/hooks/useCertificate";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
@@ -78,7 +78,11 @@ export default function CertificateStatus({
|
|||||||
{t("certificateStatus")}:
|
{t("certificateStatus")}:
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<span className="text-sm text-muted-foreground">
|
<span className="inline-flex items-center gap-1.5 text-sm text-muted-foreground">
|
||||||
|
<Loader2
|
||||||
|
className="h-3.5 w-3.5 shrink-0 animate-spin"
|
||||||
|
aria-hidden
|
||||||
|
/>
|
||||||
{t("loading")}
|
{t("loading")}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -47,18 +47,18 @@ export function useCertificate({
|
|||||||
if (showLoading) {
|
if (showLoading) {
|
||||||
setCertLoading(true);
|
setCertLoading(true);
|
||||||
}
|
}
|
||||||
setCertError(null);
|
|
||||||
try {
|
try {
|
||||||
const res = await api.get<
|
const res = await api.get<
|
||||||
AxiosResponse<GetCertificateResponse>
|
AxiosResponse<GetCertificateResponse>
|
||||||
>(`/org/${orgId}/certificate/${domainId}/${fullDomain}`);
|
>(`/org/${orgId}/certificate/${domainId}/${fullDomain}`);
|
||||||
const certData = res.data.data;
|
const certData = res.data.data;
|
||||||
if (certData) {
|
if (certData) {
|
||||||
|
setCertError(null);
|
||||||
setCert(certData);
|
setCert(certData);
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error("Failed to fetch certificate:", error);
|
console.error("Failed to fetch certificate:", error);
|
||||||
setCertError("Failed to fetch certificate");
|
setCertError("Failed");
|
||||||
} finally {
|
} finally {
|
||||||
if (showLoading) {
|
if (showLoading) {
|
||||||
setCertLoading(false);
|
setCertLoading(false);
|
||||||
@@ -84,7 +84,7 @@ export function useCertificate({
|
|||||||
}, 500);
|
}, 500);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error("Failed to restart certificate:", error);
|
console.error("Failed to restart certificate:", error);
|
||||||
setCertError("Failed to restart certificate");
|
setCertError("Failed to restart");
|
||||||
} finally {
|
} finally {
|
||||||
setRefreshing(false);
|
setRefreshing(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user