-import {Component, OnInit} from '@angular/core';
+import {Component, HostListener, OnDestroy, OnInit} from '@angular/core';
import {IdlObject} from '@eg/core/idl.service';
import {StaffCatalogService} from './catalog.service';
import {BasketService} from '@eg/share/catalog/basket.service';
@Component({
templateUrl: 'catalog.component.html'
})
-export class CatalogComponent implements OnInit {
+export class CatalogComponent implements OnInit, OnDestroy {
constructor(
private basket: BasketService,
clearHoldPatron() {
this.staffCat.clearHoldPatron();
}
+
+ @HostListener('window:beforeunload')
+ ngOnDestroy(): void {
+ this.clearHoldPatron();
+ }
}
if (!ctx.success) { reset = false; }
});
- if (reset) { this.resetRecipient(); }
+ if (reset) {
+ this.resetRecipient();
+ this.staffCat.clearHoldPatron();
+ }
}
// When placing holds on multiple copies per target, add a hold
$scope.place_hold = function() {
- egCore.hatch.setLocalItem(
+ egCore.hatch.setLoginSessionItem(
'eg.circ.patron_hold_target', patronSvc.current.card().barcode());
$window.location.href = '/eg2/staff/catalog';