* Add a an app-local login session key
*/
addLoginSessionKey(key: string): void {
- this.loginSessionKeys.push(key);
+ if (!this.loginSessionKeys.includes(key)) {
+ this.loginSessionKeys.push(key);
+ }
}
setLocalItem(key: string, val: any, isJson?: boolean): void {
import {PatronService} from '@eg/staff/share/patron/patron.service';
import {StoreService} from '@eg/core/store.service';
+const HOLD_FOR_PATRON_KEY = 'eg.circ.patron_hold_target';
+
/**
* Shared bits needed by the staff version of the catalog.
*/
this.searchContext =
this.catUrl.fromUrlParams(this.route.snapshot.queryParamMap);
- this.holdForBarcode = this.store.getLocalItem('eg.circ.patron_hold_target');
+ this.holdForBarcode = this.store.getLoginSessionItem(HOLD_FOR_PATRON_KEY);
if (this.holdForBarcode) {
this.patron.getByBarcode(this.holdForBarcode)
clearHoldPatron() {
this.holdForUser = null;
this.holdForBarcode = null;
- this.store.removeLocalItem('eg.circ.patron_hold_target');
+ this.store.removeLoginSessionItem(HOLD_FOR_PATRON_KEY);
this.holdForChange.emit();
}
private staffCat: StaffCatalogService,
private modal: NgbModal) {
super(modal);
-
- this.store.addLoginSessionKey(RECENT_SEARCHES_KEY);
}
ngOnInit() {
import {PatronContextService} from './patron.service';
import {StoreService} from '@eg/core/store.service';
+const HOLD_FOR_PATRON_KEY = 'eg.circ.patron_hold_target';
+
@Component({
templateUrl: 'holds.component.html',
selector: 'eg-patron-holds'
newHold() {
- this.store.setLocalItem(
- 'eg.circ.patron_hold_target',
+ this.store.setLoginSessionItem(HOLD_FOR_PATRON_KEY,
this.context.summary.patron.card().barcode());
this.router.navigate(['/staff/catalog/search']);
const LOGIN_PATH = '/staff/login';
const WS_MANAGE_PATH = '/staff/admin/workstation/workstations/manage';
+// Define these at the staff application level so they will be honored
+// regardless of which interface is loaded / reloaded / etc.
+const STAFF_LOGIN_SESSION_KEYS = [
+ 'eg.circ.patron_hold_target',
+ 'eg.catalog.recent_searches',
+ 'eg.circ.recent_patrons'
+]
+
/**
* Load data used by all staff modules.
*/
this.hatch.connect();
+ STAFF_LOGIN_SESSION_KEYS.forEach(
+ key => this.store.addLoginSessionKey(key));
+
// Staff cookies stay in /$base/staff/
// NOTE: storing session data at '/' so it can be shared by
// Angularjs apps.