Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
- fix lodaing avatar #1878
Browse files Browse the repository at this point in the history
  • Loading branch information
siemiatj committed Aug 8, 2018
1 parent 3fe57b5 commit 20eb310
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/api/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ export function resetPasswordComplete(token, form) {
}

export function resetPasswordGetAvatar(token) {
return axios.get(`${config.API_URL}/login/resetPassword/${token}/avatar`);
return `${config.API_URL}/login/resetPassword/${token}/avatar`;
}
16 changes: 4 additions & 12 deletions src/components/app/PasswordRecovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class PasswordRecovery extends Component {
err: '',
pending: false,
resetEmailSent: false,
avatarSrc: '',
form: {},
invalidToken: false,
};
Expand All @@ -32,7 +31,6 @@ class PasswordRecovery extends Component {
const resetPassword = token ? true : false;

if (resetPassword) {
this.getAvatar();
this.getUserData().catch(({ data }) => {
this.setState({
err: data.message,
Expand All @@ -47,11 +45,7 @@ class PasswordRecovery extends Component {
getAvatar = () => {
const { token } = this.props;

return resetPasswordGetAvatar(token).then(({ data }) => {
this.setState({
avatarSrc: data,
});
});
return resetPasswordGetAvatar(token);
};

getUserData = () => {
Expand Down Expand Up @@ -278,20 +272,18 @@ class PasswordRecovery extends Component {

renderContent = () => {
const { token } = this.props;
const { pending, resetEmailSent, avatarSrc, form } = this.state;
const { pending, resetEmailSent, form } = this.state;
const resetPassword = token ? true : false;
const buttonMessage = resetPassword
? counterpart.translate('forgotPassword.changePassword.caption')
: counterpart.translate('forgotPassword.sendResetCode.caption');
const avatarSrc = this.getAvatar();

return (
<div>
{avatarSrc && (
<div className="text-center">
<img
src={`data:image/*;base64,${avatarSrc}`}
className="avatar mt-2 mb-2"
/>
<img src={avatarSrc} className="avatar mt-2 mb-2" />
</div>
)}
{form.fullname && (
Expand Down

0 comments on commit 20eb310

Please sign in to comment.