@@ -259,18 +259,16 @@ export class UploadIndexComponent implements OnInit {
259
259
switchMap ( ( ) =>
260
260
this . picturesClient . setPictureCrop (
261
261
new SetPictureCropRequest ( {
262
- cropHeight : picture . crop . height || undefined ,
263
- cropLeft : picture . crop . left || undefined ,
264
- cropTop : picture . crop . top || undefined ,
265
- cropWidth : picture . crop . width || undefined ,
262
+ cropHeight : picture . crop . height ? Math . round ( picture . crop . height ) : undefined ,
263
+ cropLeft : picture . crop . left ? Math . round ( picture . crop . left ) : undefined ,
264
+ cropTop : picture . crop . top ? Math . round ( picture . crop . top ) : undefined ,
265
+ cropWidth : picture . crop . width ? Math . round ( picture . crop . width ) : undefined ,
266
266
pictureId : '' + picture . id ,
267
267
} ) ,
268
268
) ,
269
269
) ,
270
270
catchError ( ( response : unknown ) => {
271
- if ( response instanceof HttpErrorResponse ) {
272
- this . toastService . response ( response ) ;
273
- }
271
+ this . toastService . handleError ( response ) ;
274
272
return EMPTY ;
275
273
} ) ,
276
274
switchMap ( ( ) =>
@@ -279,14 +277,12 @@ export class UploadIndexComponent implements OnInit {
279
277
} ) ,
280
278
) ,
281
279
catchError ( ( response : unknown ) => {
282
- if ( response instanceof HttpErrorResponse ) {
283
- this . toastService . response ( response ) ;
284
- }
280
+ this . toastService . handleError ( response ) ;
285
281
return EMPTY ;
286
282
} ) ,
287
283
tap ( ( response : APIPicture ) => {
288
284
picture . crop = response . crop ;
289
- picture . cropTitle = cropTitle ( response . crop ) ;
285
+ picture . cropTitle = response . crop ? cropTitle ( response . crop ) : '' ;
290
286
picture . thumb_medium = response . thumb_medium ;
291
287
} ) ,
292
288
)
0 commit comments