@@ -19,7 +19,7 @@ import {
1919import { UserAuthenticationSettingsDTO } from "../../../IsaacApiTypes" ;
2020import { AppState , ErrorState } from "../../state/reducers" ;
2121import { updateCurrentUser , resetPassword } from "../../state/actions" ;
22- import { LoggedInUser , UserPreferencesDTO , LoggedInValidationUser } from "../../../IsaacAppTypes" ;
22+ import { LoggedInUser , UserPreferencesDTO , LoggedInValidationUser , Toast } from "../../../IsaacAppTypes" ;
2323import { UserDetails } from "../elements/UserDetails" ;
2424import { UserPassword } from "../elements/UserPassword" ;
2525import { UserEmailPreference } from "../elements/UserEmailPreferences" ;
@@ -28,6 +28,8 @@ import {Link} from "react-router-dom";
2828import { BreadcrumbTrail } from "../elements/BreadcrumbTrail" ;
2929import { EXAM_BOARD } from "../../services/constants" ;
3030import { history } from "../../services/history"
31+ import { showToast } from "../../state/actions" ;
32+ import { Toasts } from '../navigation/Toasts' ;
3133
3234const stateToProps = ( state : AppState ) => ( {
3335 errorMessage : state ? state . error : null ,
@@ -39,6 +41,7 @@ const stateToProps = (state: AppState) => ({
3941const dispatchToProps = {
4042 updateCurrentUser,
4143 resetPassword,
44+ showToast,
4245} ;
4346
4447interface AccountPageProps {
@@ -51,9 +54,10 @@ interface AccountPageProps {
5154 currentUser : LoggedInUser
5255 ) => void ;
5356 firstLogin : boolean ;
57+ showToast : ( toast : Toast ) => void ;
5458}
5559
56- const AccountPageComponent = ( { user, updateCurrentUser, errorMessage, userAuthSettings, userPreferences, firstLogin} : AccountPageProps ) => {
60+ const AccountPageComponent = ( { user, updateCurrentUser, errorMessage, userAuthSettings, userPreferences, firstLogin, showToast } : AccountPageProps ) => {
5761
5862 // Catch the (unlikely?) case where a user does not have email preferences in the database.
5963 if ( userPreferences && ! userPreferences . EMAIL_PREFERENCE ) {
@@ -137,8 +141,15 @@ const AccountPageComponent = ({user, updateCurrentUser, errorMessage, userAuthSe
137141 registeredUser : myUser ,
138142 userPreferences : myUserPreferences ,
139143 passwordCurrent : currentPassword
140- } , user )
144+ } , user ) ;
141145 }
146+ showToast ( {
147+ title : "Preferences updated" ,
148+ body : "Your user preferences were saved correctly." ,
149+ color : "success" ,
150+ timeout : 5000 ,
151+ closable : false ,
152+ } ) ;
142153 } } >
143154 < TabContent activeTab = { activeTab } >
144155 < TabPane tabId = { 0 } >
0 commit comments