fix: loading button tambah portofolio
Deskripsi: - loading button selanjutjnya - loading button simpan pin No Issues
This commit is contained in:
@@ -30,6 +30,7 @@ export function Portofolio_ComponentButtonSelanjutnya({
|
|||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
|
setLoading(true);
|
||||||
const porto = {
|
const porto = {
|
||||||
namaBisnis: dataPortofolio.namaBisnis,
|
namaBisnis: dataPortofolio.namaBisnis,
|
||||||
masterBidangBisnisId: dataPortofolio.masterBidangBisnisId,
|
masterBidangBisnisId: dataPortofolio.masterBidangBisnisId,
|
||||||
@@ -56,7 +57,6 @@ export function Portofolio_ComponentButtonSelanjutnya({
|
|||||||
fileId: uploadFileToStorage.data.id,
|
fileId: uploadFileToStorage.data.id,
|
||||||
});
|
});
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
setLoading(true);
|
|
||||||
ComponentGlobal_NotifikasiBerhasil("Berhasil disimpan");
|
ComponentGlobal_NotifikasiBerhasil("Berhasil disimpan");
|
||||||
router.replace(RouterMap.create + res.id, { scroll: false });
|
router.replace(RouterMap.create + res.id, { scroll: false });
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { useRouter } from "next/navigation";
|
|||||||
import { map_funCreatePin } from "../../fun/create/fun_create_pin";
|
import { map_funCreatePin } from "../../fun/create/fun_create_pin";
|
||||||
import { DIRECTORY_ID } from "@/app/lib";
|
import { DIRECTORY_ID } from "@/app/lib";
|
||||||
import { funGlobal_UploadToStorage } from "@/app_modules/_global/fun";
|
import { funGlobal_UploadToStorage } from "@/app_modules/_global/fun";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
export function ComponentMap_ButtonSavePin({
|
export function ComponentMap_ButtonSavePin({
|
||||||
namePin,
|
namePin,
|
||||||
@@ -26,7 +27,10 @@ export function ComponentMap_ButtonSavePin({
|
|||||||
file: File;
|
file: File;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
async function onSavePin() {
|
async function onSavePin() {
|
||||||
|
setLoading(true)
|
||||||
const uploadFileToStorage = await funGlobal_UploadToStorage({
|
const uploadFileToStorage = await funGlobal_UploadToStorage({
|
||||||
file: file,
|
file: file,
|
||||||
dirId: DIRECTORY_ID.map_image,
|
dirId: DIRECTORY_ID.map_image,
|
||||||
@@ -49,15 +53,19 @@ export function ComponentMap_ButtonSavePin({
|
|||||||
res.status === 200
|
res.status === 200
|
||||||
? (ComponentGlobal_NotifikasiBerhasil(res.message), router.back())
|
? (ComponentGlobal_NotifikasiBerhasil(res.message), router.back())
|
||||||
: ComponentGlobal_NotifikasiGagal(res.message);
|
: ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
|
loading={loading}
|
||||||
my={"xl"}
|
my={"xl"}
|
||||||
style={{ transition: "0.5s" }}
|
style={{ transition: "0.5s" }}
|
||||||
disabled={namePin === "" || file === null ? true : false}
|
disabled={namePin === "" || file === null ? true : false}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
|
loaderPosition="center"
|
||||||
bg={MainColor.yellow}
|
bg={MainColor.yellow}
|
||||||
color="yellow"
|
color="yellow"
|
||||||
c={"black"}
|
c={"black"}
|
||||||
|
|||||||
Reference in New Issue
Block a user