Skip to content

Commit

Permalink
Re-fetch user once email is updated
Browse files Browse the repository at this point in the history
Email was missing e.g. in reservation confirmation page as the updated
email was not yet updated to the user object.

Refs TTVA-223
  • Loading branch information
japauliina committed Jan 14, 2025
1 parent 606c33d commit ed2ae6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/pages/AppContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export class UnconnectedAppContainer extends Component {
<Footer />
{(userId) && (
<UserEmailFormModal
fetchUser={this.props.fetchUser}
show={userId && !userHasEmail}
userId={userId}
/>
Expand Down
6 changes: 5 additions & 1 deletion app/shared/modals/user-email-form/UserEmailFormModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import { NOTIFICATION_TYPE } from '../../../../src/common/notification/constants
import client from '../../../../src/common/api/client';
import injectT from '../../../i18n/injectT';

function UserEmailFormModal({ userId, show, t }) {
function UserEmailFormModal({
fetchUser, userId, show, t,
}) {
const [open, setOpen] = useState(false);
const [error, setError] = useState(false);
const [emailMismatch, setEmailMismatch] = useState(false);
Expand All @@ -35,6 +37,7 @@ function UserEmailFormModal({ userId, show, t }) {
.then(() => {
createNotification(NOTIFICATION_TYPE.SUCCESS, t('UserEmailForm.emailSet'));
setOpen(false);
fetchUser(userId);
})
.catch((e) => {

Check warning on line 42 in app/shared/modals/user-email-form/UserEmailFormModal.js

View workflow job for this annotation

GitHub Actions / build (10.x)

'e' is defined but never used
setError(true);
Expand Down Expand Up @@ -129,6 +132,7 @@ function UserEmailFormModal({ userId, show, t }) {
}

UserEmailFormModal.propTypes = {
fetchUser: PropTypes.func.isRequired,
userId: PropTypes.string.isRequired,
show: PropTypes.bool.isRequired,
t: PropTypes.func.isRequired,
Expand Down

0 comments on commit ed2ae6d

Please sign in to comment.