Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addBook() {
- this.errorMessage = null;
- this.fireService.getBook(this.bookDetails.isbn).subscribe(data => {
- console.log('subscribe called');
- if (null != data) {
- this.dbox.open(DialogBoxComponent, {
- data: { title: 'Error', content: 'Book is already present in Library. Select Edit book to modify the details', button: false }
- });
- this.errorMessage = 'Book is already present in Library. Select Edit book to modify the details';
- } else {
- this.fireService.addBook(this.bookDetails);
- this.dbox.open(DialogBoxComponent, {
- data: { title: 'Success', content: 'Book has been Added to Database', button: false }
- });
- this.router.navigateByUrl('/add-book');
- }
- });
- }
- getBook(id) {
- console.log('called firebase get book');
- return this.db.doc(`/books/${id}`).valueChanges();
- }
- called firebase get book
- subscribe called
- subscribe called
Add Comment
Please, Sign In to add comment