some debuging and change

main
alireza khaji 3 years ago
parent f6f7c59b01
commit f173029298
  1. 66
      src/view/register/index.js
  2. 2
      src/view/services/index.js

@ -46,6 +46,8 @@ const Register = ({
uploadImg, uploadImg,
lastUploadId, lastUploadId,
}) => { }) => {
const [submitLoading, setSubmitLoading] = useState(false);
//-----------------------------------------------
const [steps, setSteps] = useState(0); const [steps, setSteps] = useState(0);
console.log("user:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); console.log("user:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
console.log(user); console.log(user);
@ -401,7 +403,7 @@ const Register = ({
const uploadImghandler2 = (e) => { const uploadImghandler2 = (e) => {
setFiles({ ...files, shenasNameh: e }); setFiles({ ...files, shenasNameh: e });
console.log("fffffff:") console.log("fffffff:");
console.log(e); console.log(e);
uploadImg({ uploadImg({
file: e, file: e,
@ -1345,6 +1347,7 @@ const Register = ({
onClick={() => { onClick={() => {
setSteps(2); setSteps(2);
setActiveStep([true, true, true, false]); setActiveStep([true, true, true, false]);
setSubmitLoading(false);
}} }}
/> />
</div> </div>
@ -1355,59 +1358,14 @@ const Register = ({
borderType="rounded" borderType="rounded"
title="تایید" title="تایید"
// onClick={submitHandler} // onClick={submitHandler}
loading={loading} loading={submitLoading}
// to="/" // to="/"
onClick={async () => { onClick={() => {
// activeLogin() setProfile(userInfo);
try { setSubmitLoading(true);
let access = window.localStorage.getItem("access");
const formData = new FormData();
formData.append("file", files.shenasNameh);
let res = await axios.post(
ApiConfig.baseUrl + "/file/upload",
formData,
{
headers: {
"content-type": "multipart/form-data",
Authorization: `Bearer ${access}`,
},
}
);
if (res.data) {
try {
const personalPic = new FormData();
personalPic.append("file", files.personalPic);
let resp = await axios.post(
ApiConfig.baseUrl + "/file/upload",
personalPic,
{
headers: {
"content-type": "multipart/form-data",
Authorization: `Bearer ${access}`,
},
}
);
if (resp.data) {
console.log("userInfo:");
console.log(userInfo);
setProfile({
...userInfo,
shenasnamehFileId: res.data?.data?.id,
personalPicFileId: resp.data?.data?.id,
});
}
} catch (err) {
console.error(err);
toast.error(err);
}
}
} catch (error) {
console.error(error);
toast.error(error);
}
}} }}
/> />
{loading && ( {submitLoading && (
<div className="w-full h-12 rounded-lg bg-red52 flex items-center justify-center mt-4"> <div className="w-full h-12 rounded-lg bg-red52 flex items-center justify-center mt-4">
<img <img
src={loadingGiff} src={loadingGiff}
@ -1430,10 +1388,10 @@ const mapStateToProps = (state) => ({
province: state.publicApi.province, province: state.publicApi.province,
city: state.publicApi.city, city: state.publicApi.city,
user: state.user.status, user: state.user.status,
// loading: state.user.loading, loading: state.user.loading,
uploadLoading: state.file.loading, uploadLoading: state.file.loading,
termInfo: state.term.info, termInfo: state.term.info,
lastUploadId : state.file.lastUpload lastUploadId: state.file.lastUpload,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
setProfile: user.setProfile, setProfile: user.setProfile,
@ -1441,7 +1399,7 @@ const mapDispatchToProps = {
getCity: publicApi.getCity, getCity: publicApi.getCity,
getUserInfo: user.info, getUserInfo: user.info,
getRulse: term.info, getRulse: term.info,
uploadImg : file.upload uploadImg: file.upload,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(Register); export default connect(mapStateToProps, mapDispatchToProps)(Register);

@ -312,7 +312,7 @@ const Services = ({
(!fliterList.includes(product?.productType - 1) && (!fliterList.includes(product?.productType - 1) &&
(product?.gender === userInfo?.gender || (product?.gender === userInfo?.gender ||
product?.gender === null) && product?.gender === null) &&
product?.gradeIds === Number(userInfo?.gradeIds))) && ( product?.gradeId === Number(userInfo?.gradeIds))) && (
<div <div
// to={"/class/" + product?.id} // to={"/class/" + product?.id}
className="w-[30%]" className="w-[30%]"

Loading…
Cancel
Save