This provides a service for other components to use to retrieve partner information.
The Partner Service interface:
export interface PartnerServiceInterface {
getPartnerId(): Observable<string>;
}
To implement the interface make a new service that implements the interface:
…
import {PartnerServiceInterface} from '@vendasta/partner-service';
@Injectable()
export class PartnerService implements PartnerServiceInterface {
…
getPartnerId(): Observable<string> {
// Implement how the project determines which partner id the current context is in
}
}
Next you will need to provide your service as that interface (generally in app.module.ts)
import { PartnerService } from './partner.service';
import { PartnerServiceInterfaceToken } from '@vendasta/partner-service';
…
@NgModule({
…
providers: [
PartnerService, {provide: PartnerServiceInterfaceToken, useExisting: PartnerService}
],
})
PartnerServiceInterfaceToken vs PartnerServiceInterface).