@@ -23,6 +23,7 @@ import { HttpErrorResponse } from '@angular/common/http'
2323import { TagService } from '../../services/tag-service'
2424import { TitleService } from '../../services/title-service'
2525import { DomSanitizer , SafeHtml } from '@angular/platform-browser'
26+ import { NotificationsService } from '../../services/notifications-service'
2627
2728@Component ( {
2829 selector : 'app-article-page' ,
@@ -47,6 +48,7 @@ export class ArticlePage implements OnInit {
4748 private readonly titleService = inject ( TitleService )
4849 private readonly destroyRef = inject ( DestroyRef )
4950 private readonly domSanitizer = inject ( DomSanitizer )
51+ private readonly notificationsService = inject ( NotificationsService )
5052
5153 readonly article = signal < Article | null > ( null )
5254 readonly fullText = signal < SafeHtml | undefined > ( undefined )
@@ -86,6 +88,9 @@ export class ArticlePage implements OnInit {
8688 takeUntilDestroyed ( this . destroyRef ) ,
8789 catchError ( ( error : HttpErrorResponse ) => {
8890 console . error ( error )
91+ this . notificationsService . setNotification ( {
92+ message : error . error . message ,
93+ } )
8994 return of ( null )
9095 } ) ,
9196 )
@@ -117,6 +122,9 @@ export class ArticlePage implements OnInit {
117122 takeUntilDestroyed ( this . destroyRef ) ,
118123 catchError ( ( error : HttpErrorResponse ) => {
119124 console . error ( error )
125+ this . notificationsService . setNotification ( {
126+ message : error . error . message ,
127+ } )
120128 return of ( null )
121129 } ) ,
122130 )
@@ -147,6 +155,9 @@ export class ArticlePage implements OnInit {
147155 takeUntilDestroyed ( this . destroyRef ) ,
148156 catchError ( ( error : HttpErrorResponse ) => {
149157 console . error ( error )
158+ this . notificationsService . setNotification ( {
159+ message : error . error . message ,
160+ } )
150161 return of ( null )
151162 } ) ,
152163 )
@@ -171,9 +182,12 @@ export class ArticlePage implements OnInit {
171182 . getFullText ( { articleId } )
172183 . pipe (
173184 takeUntilDestroyed ( this . destroyRef ) ,
174- catchError ( ( e ) => {
175- console . error ( e )
185+ catchError ( ( error ) => {
186+ console . error ( error )
176187 this . isLoading . set ( false )
188+ this . notificationsService . setNotification ( {
189+ message : error . error . message ,
190+ } )
177191 return of ( null )
178192 } ) ,
179193 )
0 commit comments