@@ -19,7 +19,7 @@ import {
19
19
import { UserAuthenticationSettingsDTO } from "../../../IsaacApiTypes" ;
20
20
import { AppState , ErrorState } from "../../state/reducers" ;
21
21
import { updateCurrentUser , resetPassword } from "../../state/actions" ;
22
- import { LoggedInUser , UserPreferencesDTO , LoggedInValidationUser } from "../../../IsaacAppTypes" ;
22
+ import { LoggedInUser , UserPreferencesDTO , LoggedInValidationUser , Toast } from "../../../IsaacAppTypes" ;
23
23
import { UserDetails } from "../elements/UserDetails" ;
24
24
import { UserPassword } from "../elements/UserPassword" ;
25
25
import { UserEmailPreference } from "../elements/UserEmailPreferences" ;
@@ -28,6 +28,8 @@ import {Link} from "react-router-dom";
28
28
import { BreadcrumbTrail } from "../elements/BreadcrumbTrail" ;
29
29
import { EXAM_BOARD } from "../../services/constants" ;
30
30
import { history } from "../../services/history"
31
+ import { showToast } from "../../state/actions" ;
32
+ import { Toasts } from '../navigation/Toasts' ;
31
33
32
34
const stateToProps = ( state : AppState ) => ( {
33
35
errorMessage : state ? state . error : null ,
@@ -39,6 +41,7 @@ const stateToProps = (state: AppState) => ({
39
41
const dispatchToProps = {
40
42
updateCurrentUser,
41
43
resetPassword,
44
+ showToast,
42
45
} ;
43
46
44
47
interface AccountPageProps {
@@ -51,9 +54,10 @@ interface AccountPageProps {
51
54
currentUser : LoggedInUser
52
55
) => void ;
53
56
firstLogin : boolean ;
57
+ showToast : ( toast : Toast ) => void ;
54
58
}
55
59
56
- const AccountPageComponent = ( { user, updateCurrentUser, errorMessage, userAuthSettings, userPreferences, firstLogin} : AccountPageProps ) => {
60
+ const AccountPageComponent = ( { user, updateCurrentUser, errorMessage, userAuthSettings, userPreferences, firstLogin, showToast } : AccountPageProps ) => {
57
61
58
62
// Catch the (unlikely?) case where a user does not have email preferences in the database.
59
63
if ( userPreferences && ! userPreferences . EMAIL_PREFERENCE ) {
@@ -137,8 +141,15 @@ const AccountPageComponent = ({user, updateCurrentUser, errorMessage, userAuthSe
137
141
registeredUser : myUser ,
138
142
userPreferences : myUserPreferences ,
139
143
passwordCurrent : currentPassword
140
- } , user )
144
+ } , user ) ;
141
145
}
146
+ showToast ( {
147
+ title : "Preferences updated" ,
148
+ body : "Your user preferences were saved correctly." ,
149
+ color : "success" ,
150
+ timeout : 5000 ,
151
+ closable : false ,
152
+ } ) ;
142
153
} } >
143
154
< TabContent activeTab = { activeTab } >
144
155
< TabPane tabId = { 0 } >
0 commit comments