@@ -22,7 +22,9 @@ import { UserInfoStore } from '../../core/user/user-info.store';
2222import { SuggestedTagsStore } from '../../core/user/suggested-tags.store' ;
2323import { WebpageInfo } from '../../core/model/webpage-info' ;
2424import { MyBookmarksStore } from '../../core/user/my-bookmarks.store' ;
25- import { PublicBookmarkPresentDialogComponent } from './public-bookmark-present-dialog/public-bookmark-present-dialog.component' ;
25+ import {
26+ PublicBookmarkPresentDialogComponent
27+ } from './public-bookmark-present-dialog/public-bookmark-present-dialog.component' ;
2628import { AdminService } from '../../core/admin/admin.service' ;
2729import { WebpageInfoService } from '../../core/webpage-info/webpage-info.service' ;
2830import { UserDataHistoryStore } from '../../core/user/userdata.history.store' ;
@@ -34,6 +36,7 @@ import { StackoverflowHelper } from '../../core/helper/stackoverflow.helper';
3436import { UserDataPinnedStore } from '../../core/user/userdata.pinned.store' ;
3537import { MatChipInputEvent } from '@angular/material/chips' ;
3638import { MatAutocompleteActivatedEvent , MatAutocompleteSelectedEvent } from '@angular/material/autocomplete' ;
39+ import iziToast , { IziToastSettings } from 'izitoast' ;
3740
3841@Component ( {
3942 selector : 'app-save-bookmark-form' ,
@@ -192,7 +195,7 @@ export class SaveBookmarkFormComponent implements OnInit {
192195 if ( isNewBookmark ) {
193196 this . bookmarkForm . get ( 'location' ) . valueChanges . pipe (
194197 debounceTime ( 1000 ) ,
195- distinctUntilChanged ( ) , )
198+ distinctUntilChanged ( ) , )
196199 . subscribe ( location => {
197200 this . verifyExistenceInPersonalBookmarks ( location ) ;
198201 } ) ;
@@ -377,9 +380,18 @@ export class SaveBookmarkFormComponent implements OnInit {
377380 concatMap ( ( updatedBookmark ) => this . userDataStore . updateUserDataHistory$ ( updatedBookmark ) )
378381 ) . subscribe (
379382 ( ) => {
380- this . navigateToHomePageHistoryTab ( )
383+ this . navigateToHomePageHistoryTab ( ) ;
381384 } ,
382- ( ) => this . navigateToHomePageHistoryTab ( ) // TODO add error handling - popover
385+ ( response ) => {
386+ const iziToastSettings : IziToastSettings = {
387+ title : `Error when updating ${ bookmark . name } ` ,
388+ messageLineHeight : '5' ,
389+ timeout : false ,
390+ message : response . message + ' ' + response ?. validationErrors
391+ }
392+ iziToast . error ( iziToastSettings ) ;
393+ this . navigateToHomePageHistoryTab ( )
394+ } // TODO add error handling - popover }
383395 ) ;
384396 }
385397 }
@@ -439,17 +451,17 @@ export class SaveBookmarkFormComponent implements OnInit {
439451 this . publishInUserDataStores ( newBookmark , readLater , pinned ) ;
440452 this . navigateToBookmarkDetails ( newBookmark ) ;
441453
442- /* if (this.url) {
443- if (this.popup) {
444- this.navigateToBookmarkDetails(newBookmark);
445- } else if (this.popupExt) {
446- this.navigateToHomePageHistoryTab();
447- } else {
448- window.location.href = this.url;
449- }
450- } else {
451- this.navigateToHomePageHistoryTab();
452- }*/
454+ /* if (this.url) {
455+ if (this.popup) {
456+ this.navigateToBookmarkDetails(newBookmark);
457+ } else if (this.popupExt) {
458+ this.navigateToHomePageHistoryTab();
459+ } else {
460+ window.location.href = this.url;
461+ }
462+ } else {
463+ this.navigateToHomePageHistoryTab();
464+ }*/
453465 } ) ;
454466 } ,
455467 ( error : HttpResponse < any > ) => {
0 commit comments