|
|
@ -20,7 +20,7 @@ import Checkbox from "../../components/Checkbox"; |
|
|
|
import { ostan } from "../../constants/states"; |
|
|
|
import { ostan } from "../../constants/states"; |
|
|
|
import { cities } from "../../constants/cities"; |
|
|
|
import { cities } from "../../constants/cities"; |
|
|
|
import _onInput from "../../utils/onInput"; |
|
|
|
import _onInput from "../../utils/onInput"; |
|
|
|
import { file, publicApi, user,term } from "../../redux/actions"; |
|
|
|
import { file, publicApi, user, term } from "../../redux/actions"; |
|
|
|
import { VscDebugBreakpointUnsupported } from "react-icons/vsc"; |
|
|
|
import { VscDebugBreakpointUnsupported } from "react-icons/vsc"; |
|
|
|
import axios from "axios"; |
|
|
|
import axios from "axios"; |
|
|
|
import { ApiConfig } from "../../constants/defaultValues"; |
|
|
|
import { ApiConfig } from "../../constants/defaultValues"; |
|
|
@ -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); |
|
|
|