Skip to content

Commit

Permalink
fix(frontend): button click feedback on form update (#1692)
Browse files Browse the repository at this point in the history
* fix(formUpdateTab): loading state add on form update

* fix(formUpdateTab): solve ts type error
  • Loading branch information
NSUWAL123 authored Jul 23, 2024
1 parent 41fa323 commit b8c9c83
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const FormUpdateTab = ({ projectId }) => {
const sortedFormCategoryList = formCategoryList.slice().sort((a, b) => a.title.localeCompare(b.title));
const customFileValidity = useAppSelector((state) => state.createproject.customFileValidity);
const validateCustomFormLoading = useAppSelector((state) => state.createproject.validateCustomFormLoading);
const formUpdateLoading = useAppSelector((state) => state.createproject.formUpdateLoading);

useEffect(() => {
dispatch(FormCategoryService(`${import.meta.env.VITE_API_URL}/central/list-forms`));
Expand Down Expand Up @@ -91,7 +92,7 @@ const FormUpdateTab = ({ projectId }) => {
label="title"
value={selectedCategory}
onValueChange={(value) => {
setSelectedCategory(value);
if (value) setSelectedCategory(value?.toString());
}}
className="fmtm-max-w-[13.5rem]"
/>
Expand Down Expand Up @@ -130,7 +131,14 @@ const FormUpdateTab = ({ projectId }) => {
{error.formError && <p className="fmtm-text-primaryRed fmtm-text-base">{error.formError}</p>}
</div>
<div className="fmtm-flex fmtm-justify-center">
<Button onClick={onSave} btnText="UPDATE" btnType="primary" className="fmtm-rounded-md" />
<Button
isLoading={formUpdateLoading}
loadingText="UPDATE"
onClick={onSave}
btnText="UPDATE"
btnType="primary"
className="fmtm-rounded-md"
/>
</div>
</div>
);
Expand Down

0 comments on commit b8c9c83

Please sign in to comment.