blob: 88a1aeb7fde9358edf3c8c032b6474fa2878724e [file] [log] [blame]
/********************************************************************************
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import { InternalPersonDetailsSandBox } from '@app/pages/persons/internal-person/internal-person-details/internal-person-details.sandbox';
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class InternalPersonResolver implements Resolve<any>{
constructor(
private internalPersonSandbox: InternalPersonDetailsSandBox,
) { }
/**
* Triggered when application hits code table details or code value details route.
* @param route
*/
public resolve(route: ActivatedRouteSnapshot): void {
const contactId: string = route.params['contactId'];
if (contactId && (contactId !== 'new')) {
this.internalPersonSandbox.loadInternalPerson(contactId);
} else {
this.internalPersonSandbox.clear();
}
}
}