|
|
|
@ -46,6 +46,8 @@ const Register = ({ |
|
|
|
|
uploadImg, |
|
|
|
|
lastUploadId, |
|
|
|
|
}) => { |
|
|
|
|
const [submitLoading, setSubmitLoading] = useState(false); |
|
|
|
|
//-----------------------------------------------
|
|
|
|
|
const [steps, setSteps] = useState(0); |
|
|
|
|
console.log("user:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); |
|
|
|
|
console.log(user); |
|
|
|
@ -401,7 +403,7 @@ const Register = ({ |
|
|
|
|
|
|
|
|
|
const uploadImghandler2 = (e) => { |
|
|
|
|
setFiles({ ...files, shenasNameh: e }); |
|
|
|
|
console.log("fffffff:") |
|
|
|
|
console.log("fffffff:"); |
|
|
|
|
console.log(e); |
|
|
|
|
uploadImg({ |
|
|
|
|
file: e, |
|
|
|
@ -1345,6 +1347,7 @@ const Register = ({ |
|
|
|
|
onClick={() => { |
|
|
|
|
setSteps(2); |
|
|
|
|
setActiveStep([true, true, true, false]); |
|
|
|
|
setSubmitLoading(false); |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
@ -1355,59 +1358,14 @@ const Register = ({ |
|
|
|
|
borderType="rounded" |
|
|
|
|
title="تایید" |
|
|
|
|
// onClick={submitHandler}
|
|
|
|
|
loading={loading} |
|
|
|
|
loading={submitLoading} |
|
|
|
|
// to="/"
|
|
|
|
|
onClick={async () => { |
|
|
|
|
// activeLogin()
|
|
|
|
|
try { |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
onClick={() => { |
|
|
|
|
setProfile(userInfo); |
|
|
|
|
setSubmitLoading(true); |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
{loading && ( |
|
|
|
|
{submitLoading && ( |
|
|
|
|
<div className="w-full h-12 rounded-lg bg-red52 flex items-center justify-center mt-4"> |
|
|
|
|
<img |
|
|
|
|
src={loadingGiff} |
|
|
|
@ -1430,10 +1388,10 @@ const mapStateToProps = (state) => ({ |
|
|
|
|
province: state.publicApi.province, |
|
|
|
|
city: state.publicApi.city, |
|
|
|
|
user: state.user.status, |
|
|
|
|
// loading: state.user.loading,
|
|
|
|
|
loading: state.user.loading, |
|
|
|
|
uploadLoading: state.file.loading, |
|
|
|
|
termInfo: state.term.info, |
|
|
|
|
lastUploadId : state.file.lastUpload |
|
|
|
|
lastUploadId: state.file.lastUpload, |
|
|
|
|
}); |
|
|
|
|
const mapDispatchToProps = { |
|
|
|
|
setProfile: user.setProfile, |
|
|
|
@ -1441,7 +1399,7 @@ const mapDispatchToProps = { |
|
|
|
|
getCity: publicApi.getCity, |
|
|
|
|
getUserInfo: user.info, |
|
|
|
|
getRulse: term.info, |
|
|
|
|
uploadImg : file.upload |
|
|
|
|
uploadImg: file.upload, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Register); |
|
|
|
|