|
@@ -22,7 +22,11 @@ const YourProfile = ({state, orders, loginStatus = {}, updateStatus, updatedUser
|
|
|
const [password, changePassword] = useState(null);
|
|
|
const [password2, changePassword2] = useState(null);
|
|
|
const [isUpdateImg, changeImg] = useState(false);
|
|
|
- const [falseTrying, OneRty] = useState(false)
|
|
|
+
|
|
|
+ const date = new Date(data ? +data.createdAt : 0);
|
|
|
+ const [showUpdate, onShow] = useState(false);
|
|
|
+ const [searchInput, changeValue] = useState("Пошук");
|
|
|
+
|
|
|
// const [isUpdatePage, changePage] = useState(false);
|
|
|
// const [newImage, getImage] = useState({});
|
|
|
|
|
@@ -49,7 +53,8 @@ const YourProfile = ({state, orders, loginStatus = {}, updateStatus, updatedUser
|
|
|
await onLogin(newLogin|| data.login, password || nowPassword);
|
|
|
|
|
|
}
|
|
|
- // window.location.reload()
|
|
|
+ onShow(false)
|
|
|
+ window.location.reload()
|
|
|
|
|
|
}
|
|
|
}, [updateStatus])
|
|
@@ -57,9 +62,7 @@ const YourProfile = ({state, orders, loginStatus = {}, updateStatus, updatedUser
|
|
|
|
|
|
|
|
|
|
|
|
- const date = new Date(data ? +data.createdAt : 0);
|
|
|
- const [showUpdate, onShow] = useState(false);
|
|
|
- const [searchInput, changeValue] = useState("Пошук");
|
|
|
+
|
|
|
|
|
|
|
|
|
console.log(state);
|
|
@@ -110,7 +113,7 @@ const YourProfile = ({state, orders, loginStatus = {}, updateStatus, updatedUser
|
|
|
|
|
|
|
|
|
{(!isAdmin || (isAdmin && isOwner.id == data._id))&&
|
|
|
- <input type = "password" onChange = {(e) => superPassword(e.target.value)} placeholder = "Пароль"/>}
|
|
|
+ <input type = "password" onBlur = {() => onLogin(data.login, nowPassword)} onChange = {(e) => superPassword(e.target.value)} placeholder = "Пароль"/>}
|
|
|
|
|
|
<input onChange = {(e) => changeNick(e.target.value)} placeholder = "Новий нікнейм"/>
|
|
|
<input onChange = {(e) => changeLogin(e.target.value)} placeholder = "Новий логін"/>
|
|
@@ -124,16 +127,19 @@ const YourProfile = ({state, orders, loginStatus = {}, updateStatus, updatedUser
|
|
|
}
|
|
|
}/>
|
|
|
<button disabled = {(newPicture == "PENDING") ||
|
|
|
- ( !isAdmin && !nowPassword) ||
|
|
|
- ((isAdmin && isOwner.id == data._id) && !nowPassword )}
|
|
|
+ ( !isAdmin && (!nowPassword)) ||
|
|
|
+ ((isAdmin && isOwner.id == data._id) && !nowPassword ) ||
|
|
|
+ (Object.keys(loginStatus).length == 0) ||
|
|
|
+ (loginStatus.status && loginStatus.status == "RESOLVED" && !loginStatus.payload.data.login)
|
|
|
+ }
|
|
|
onClick = {
|
|
|
async () => {
|
|
|
|
|
|
- if(!isAdmin || (isAdmin && isOwner.id == data._id)){
|
|
|
+ // if(!isAdmin || (isAdmin && isOwner.id == data._id)){
|
|
|
|
|
|
- await onLogin( data.login, nowPassword);
|
|
|
+ // await onLogin(data.login, nowPassword);
|
|
|
|
|
|
- }
|
|
|
+ // }
|
|
|
let newUser = {};
|
|
|
newUser._id = data._id;
|
|
|
if(nick){
|