Skip to content

Commit

Permalink
Merge pull request #150 from andersinno/TTVA-223-fetch-updated-email
Browse files Browse the repository at this point in the history
Refs TTVA-223 | Re-fetch user once email is updated
  • Loading branch information
japauliina authored Jan 14, 2025
2 parents 606c33d + ed2ae6d commit ae2812a
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 ae2812a

Please sign in to comment.