import { OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { UserService } from '../../core/shared';

export class BaseComponent implements OnInit {
    protected lang: string;

    constructor(protected userService: UserService,
        protected route: ActivatedRoute) {
    }

    ngOnInit(): void {
        const langParamName: string = 'lang';
        this.lang = this.route.snapshot.data[langParamName];

        if (this.userService) {
            const isTestPropertyName: string = 'test';
            this.userService.testParam = this.route.snapshot.data[isTestPropertyName];
        }
    }
}
