Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Component, OnDestroy, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { GetUserSalariesSurveyDataResponse, SurveyService } from "@services/salaries-survey.service";
import { TitleService } from "@services/title.service";
import { AuthService } from "@shared/services/auth/auth.service";
import { CookieService } from "ngx-cookie-service";
import { untilDestroyed } from "@shared/subscriptions/until-destroyed";

@Component({
Expand All @@ -14,17 +17,27 @@ export class SalariesSurveyPageComponent implements OnInit, OnDestroy {

constructor(
private readonly service: SurveyService,
private readonly router: Router,
private readonly authService: AuthService,
private readonly cookieService: CookieService,
private readonly titleService: TitleService
) {
titleService.setTitle("Опрос о пользе зарплатной статистики");
}

ngOnInit(): void {
this.service.getUserSalariesSurveyDataResponse()
.pipe(untilDestroyed(this))
.subscribe((data) => {
this.userData = data;
});
if (this.authService.isAuthenticated()) {
this.service.getUserSalariesSurveyDataResponse()
.pipe(untilDestroyed(this))
.subscribe((data) => {
this.userData = data;
});

return;
}

this.cookieService.set("url", this.router.url);
this.authService.login();
}

closeSurveyBlock(): void {}
Expand Down