upd: loading saat melakukan aksi pada detail pengaduan

- mencegah 2x klik

NO Issues
This commit is contained in:
2026-01-09 15:53:41 +08:00
parent c0471f47f3
commit 98ad9b0d72

View File

@@ -93,6 +93,7 @@ function DetailDataPengaduan({
const [keterangan, setKeterangan] = useState("");
const [host, setHost] = useState<User | null>(null);
const [permissions, setPermissions] = useState<JsonValue[]>([]);
const [isLoading, setIsLoading] = useState(false);
useEffect(() => {
async function fetchHost() {
@@ -111,6 +112,7 @@ function DetailDataPengaduan({
const handleKonfirmasi = async (cat: "terima" | "tolak") => {
try {
setIsLoading(true);
const res = await apiFetch.api.pengaduan["update-status"].post({
id: data?.id,
status:
@@ -184,6 +186,8 @@ function DetailDataPengaduan({
message: "Failed to update pengaduan",
type: "error",
});
} finally {
setIsLoading(false);
}
};
@@ -218,6 +222,7 @@ function DetailDataPengaduan({
color="red"
disabled={keterangan.length < 1}
onClick={() => handleKonfirmasi("tolak")}
loading={isLoading}
>
Tolak
</Button>
@@ -242,6 +247,7 @@ function DetailDataPengaduan({
variant="filled"
color="green"
onClick={() => handleKonfirmasi("terima")}
loading={isLoading}
>
Ya
</Button>