Revision 53270
Added by Sofia Baltzi over 5 years ago
modules/uoa-admin-portal/branches/project-cli/src/app/pages/usernotifications/manage-user-notifications.component.ts | ||
---|---|---|
52 | 52 |
|
53 | 53 |
if (Session.getUser()) { |
54 | 54 |
this.userEmail = Session.getUserEmail(); |
55 |
} |
|
56 | 55 |
|
57 |
this._manageUserNotificationsService.getUserNotifications(this.properties.adminToolsAPIURL + "community/" + this.communityId + "/notifications", this.userEmail).subscribe( |
|
58 |
// TODO delete after meeting |
|
59 |
// this._manageUserNotificationsService.getUserNotifications("http://scoobydoo.di.uoa.gr:8080/uoa-admin-tools/community/" + this.communityId + "/notifications", this.userEmail).subscribe( |
|
60 |
userNotifications => { |
|
61 |
this.userNotifications = userNotifications; |
|
56 |
this._manageUserNotificationsService.getUserNotifications(this.properties.adminToolsAPIURL + "community/" + this.communityId + "/notifications", this.userEmail).subscribe( |
|
57 |
userNotifications => { |
|
58 |
this.userNotifications = userNotifications; |
|
62 | 59 |
|
63 |
if (this.userNotifications['notifyForNewManagers'] == null || this.userNotifications['notifyForNewSubscribers'] == null) { |
|
64 |
this.userNotifications = this.initiateUserNotifications(); |
|
60 |
if (this.userNotifications['notifyForNewManagers'] == null || this.userNotifications['notifyForNewSubscribers'] == null) { |
|
61 |
this.userNotifications = this.initiateUserNotifications(); |
|
62 |
} |
|
63 |
|
|
64 |
//TODO remove after final testing |
|
65 |
console.log("Before: ", userNotifications); |
|
66 |
console.log("After: ", this.userNotifications); |
|
67 |
this.showLoading = false; |
|
68 |
}, |
|
69 |
error => { |
|
70 |
console.log(error.status); |
|
71 |
if (error.status == '404') { |
|
72 |
this.userNotifications = this.initiateUserNotifications(); |
|
73 |
console.log(this.userNotifications); |
|
74 |
this.showLoading = false; |
|
75 |
} else { |
|
76 |
this.handleError('System error retrieving user notifications', error) |
|
77 |
} |
|
65 | 78 |
} |
66 |
|
|
67 |
//TODO remove after final testing |
|
68 |
console.log("Before: ", userNotifications); |
|
69 |
console.log("After: ", this.userNotifications); |
|
70 |
this.showLoading = false; |
|
71 |
}, |
|
72 |
error => this.handleError('System error retrieving user notifications', error) |
|
73 |
); |
|
79 |
); |
|
80 |
} |
|
74 | 81 |
} |
75 | 82 |
} |
76 | 83 |
); |
... | ... | |
94 | 101 |
console.log(userNotifications); |
95 | 102 |
|
96 | 103 |
this._manageUserNotificationsService.updateUserNotifications(this.properties.adminToolsAPIURL + "community/" + this.communityId + "/notifications", userNotifications).subscribe( |
97 |
// TODO delete after meeting |
|
98 |
// this._manageUserNotificationsService.updateUserNotifications("http://scoobydoo.di.uoa.gr:8080/uoa-admin-tools/community/" + this.communityId + "/notifications", userNotifications).subscribe( |
|
99 | 104 |
userNotifications => { |
100 | 105 |
this.handleSuccessfulSave('Notification settings saved!') |
101 | 106 |
}, |
... | ... | |
128 | 133 |
this.errorMessage = ""; |
129 | 134 |
|
130 | 135 |
this._manageUserNotificationsService.getUserNotifications(this.properties.adminToolsAPIURL + "community/" + this.communityId + "/notifications", this.userEmail).subscribe( |
131 |
// TODO delete after meeting |
|
132 |
// this._manageUserNotificationsService.getUserNotifications("http://scoobydoo.di.uoa.gr:8080/uoa-admin-tools/community/" + this.communityId + "/notifications", this.userEmail).subscribe( |
|
133 | 136 |
userNotifications => { |
134 | 137 |
this.userNotifications = userNotifications; |
135 | 138 |
this.showLoading = false; |
Also available in: Unified diff
Add show notifications in case of error at manage user notifications page