Skip to content

Commit

Permalink
Undefined role message (fixes #426) (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
MacNew authored and lmmrssa committed Feb 27, 2018
1 parent 9f69fc5 commit 45505ed
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/courses/courses.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/app/meetups/meetups.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/resources/resources.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/app/users/users.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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() {
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 45505ed

Please sign in to comment.