feat(dashboard): loading spinner and success toast on profile save
The ثبت اطلاعات button gave no feedback. Show a spinner while saving (both POST and PATCH) and a 'اطلاعات با موفقیت ثبت شد' toast on success, for the info tab and the medical-history sub-tabs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ import FamilyHistory from "./familyHistory";
|
||||
import Relatives from "./relatives";
|
||||
import { removeAdditionalKeysDashboard } from "@/helper";
|
||||
import Cookies from "js-cookie";
|
||||
import { toast } from "react-toastify";
|
||||
import LoadingComponent from "@/app/component/LoadingComponent";
|
||||
|
||||
function DetailUser({ user, isTurnsDetails, setIsTurnsDetails }) {
|
||||
@@ -43,6 +44,7 @@ function DetailUser({ user, isTurnsDetails, setIsTurnsDetails }) {
|
||||
)
|
||||
.then(() => {
|
||||
setLoading(false);
|
||||
toast.success("اطلاعات با موفقیت ثبت شد");
|
||||
})
|
||||
.catch(() => {
|
||||
setLoading(false);
|
||||
|
||||
@@ -5,8 +5,9 @@ import {
|
||||
removeAdditionalKeysDashboard,
|
||||
} from "@/helper";
|
||||
import { request } from "@/services/response";
|
||||
import { Button } from "@mui/material";
|
||||
import { Button, CircularProgress } from "@mui/material";
|
||||
import Cookies from "js-cookie";
|
||||
import { toast } from "react-toastify";
|
||||
|
||||
function ButtonSendData({
|
||||
loading,
|
||||
@@ -51,6 +52,7 @@ function ButtonSendData({
|
||||
uuid: response.uuid,
|
||||
});
|
||||
setLoading(false);
|
||||
toast.success("اطلاعات با موفقیت ثبت شد");
|
||||
})
|
||||
.catch(() => {
|
||||
setLoading(false);
|
||||
@@ -73,6 +75,7 @@ function ButtonSendData({
|
||||
)
|
||||
.then(() => {
|
||||
setLoading(false);
|
||||
toast.success("اطلاعات با موفقیت ثبت شد");
|
||||
})
|
||||
.catch((err) => handleErrReq(err));
|
||||
};
|
||||
@@ -96,8 +99,14 @@ function ButtonSendData({
|
||||
!mt-[32px] sm:!mt-[38px] md:!mt-[43px] lg:!mt-[48px] !px-[16px] sm:!px-[19px] md:!px-[22px] lg:!px-[24px]
|
||||
`}
|
||||
>
|
||||
ثبت اطلاعات
|
||||
<ArrowLeftWhiteD />
|
||||
{loading ? (
|
||||
<CircularProgress size={20} sx={{ color: "#fff" }} />
|
||||
) : (
|
||||
<>
|
||||
ثبت اطلاعات
|
||||
<ArrowLeftWhiteD />
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user