diff --git a/src/app/courses/courses.component.ts b/src/app/courses/courses.component.ts index b386780c1a..69902d721f 100644 --- a/src/app/courses/courses.component.ts +++ b/src/app/courses/courses.component.ts @@ -52,7 +52,7 @@ export class CoursesComponent implements OnInit, AfterViewInit { }).filter((c: any) => { return c._id !== '_design/course-validators'; }); - }); + }, (error) => this.planetMessageService.showAlert('There was a problem getting courses')); } ngAfterViewInit() { diff --git a/src/app/meetups/meetups.component.ts b/src/app/meetups/meetups.component.ts index e2f1f10ca2..4b7447accd 100644 --- a/src/app/meetups/meetups.component.ts +++ b/src/app/meetups/meetups.component.ts @@ -39,7 +39,7 @@ export class MeetupsComponent implements OnInit, AfterViewInit { // _all_docs returns object with rows array of objects with 'doc' property that has an object with the data. // Map over data.rows to remove the 'doc' property layer this.meetups.data = data.rows.map(meetup => meetup.doc); - }, (error) => this.message = 'There was a problem getting meetups'); + }, (error) => this.planetMessageService.showAlert('There was a problem getting meetups')); } deleteClick(meetup) { diff --git a/src/app/resources/resources.component.ts b/src/app/resources/resources.component.ts index cb76f024f8..3139d21f4b 100644 --- a/src/app/resources/resources.component.ts +++ b/src/app/resources/resources.component.ts @@ -125,7 +125,7 @@ export class ResourcesComponent implements OnInit, AfterViewInit { // Sort in descending articleDate order, so the new resource can be shown on the top data.rows.sort((a, b) => b.doc.articleDate - a.doc.articleDate); this.resources.data = data.rows.map(res => res.doc); - }, error => (this.message = 'Error')); + }, (error) => this.planetMessageService.showAlert('There was a problem getting resources')); } } diff --git a/src/app/users/users.component.ts b/src/app/users/users.component.ts index f39674d18f..3b76a72772 100644 --- a/src/app/users/users.component.ts +++ b/src/app/users/users.component.ts @@ -7,6 +7,7 @@ import { environment } from '../../environments/environment'; import { MatTableDataSource, MatSort, MatPaginator } from '@angular/material'; import { SelectionModel } from '@angular/cdk/collections'; import { Router } from '@angular/router'; +import { PlanetMessageService } from '../shared/planet-message.service'; @Component({ templateUrl: './users.component.html', @@ -47,7 +48,8 @@ export class UsersComponent implements OnInit, AfterViewInit { constructor( private userService: UserService, private couchService: CouchService, - private router: Router + private router: Router, + private planetMessageService: PlanetMessageService ) {} ngOnInit() { @@ -56,7 +58,7 @@ export class UsersComponent implements OnInit, AfterViewInit { this.initializeData(); } else { // A non-admin user cannot receive all user docs - this.message = 'Access restricted to admins'; + this.planetMessageService.showAlert('Access restricted to admins'); this.displayTable = false; } }