refactor: move TabStorage to service

This commit is contained in:
2024-08-28 02:01:39 +03:00
parent 42e454c4d6
commit 60218a73f2
5 changed files with 26 additions and 26 deletions

View File

@ -17,7 +17,7 @@ import {GroupService} from "@api/v1/group.service";
import {ProfessorService} from "@api/v1/professor.service";
import {AuthRoles} from "@model/AuthRoles";
import {HasRoleDirective} from "@/directives/has-role.directive";
import {TabStorageComponent} from "@component/common/tab-storage/tab-storage.component";
import {TabStorageService} from "@service/tab-storage.service";
export enum TabsSelect {
Group,
@ -44,7 +44,7 @@ export enum TabsSelect {
],
templateUrl: './tabs.component.html',
styleUrl: './tabs.component.css',
providers: [ScheduleService, DisciplineService, LectureHallService, GroupService, ProfessorService]
providers: [ScheduleService, DisciplineService, LectureHallService, GroupService, ProfessorService, TabStorageService]
})
export class TabsComponent implements AfterViewInit {
@ -58,13 +58,13 @@ export class TabsComponent implements AfterViewInit {
}
ngAfterViewInit(): void {
let selected = TabStorageComponent.selected;
let selected = TabStorageService.selected;
let index = 0;
if (selected !== null)
index = selected.type;
if (this.tabs.selectedIndex === null || this.tabs.selectedIndex === 0)
if (index === null || index === 0)
this.chooseTabs(0).then();
else
this.tabs.selectedIndex = index;