feat: add navigator service

This commit is contained in:
Polianin Nikita 2024-06-11 00:23:48 +03:00
parent 781599e2b7
commit 06f6efe023
2 changed files with 41 additions and 2 deletions

View File

@ -1,7 +1,28 @@
import { Routes } from '@angular/router';
import {Routes} from '@angular/router';
import {ScheduleComponent} from "@page/schedule/schedule.component";
import {WelcomeComponent} from "@page/setup/welcome/welcome.component";
import {DatabaseComponent} from "@page/setup/database/database.component";
import {CacheComponent} from "@page/setup/cache/cache.component";
import {LoggingComponent} from "@page/setup/logging/logging.component";
import {ScheduleComponent as SetupScheduleComponent} from "@page/setup/schedule/schedule.component";
import {SetupComponent} from "@page/setup/setup.component";
import {CreateAdminComponent} from "@page/setup/create-admin/create-admin.component";
import {SummaryComponent} from "@page/setup/summary/summary.component";
export const routes: Routes = [];
export const routes: Routes = [
{path: '', title: 'Расписание', pathMatch: 'full', component: ScheduleComponent},
{
path: 'setup', title: 'Установка', component: SetupComponent, children: [
{path: 'welcome', component: WelcomeComponent},
{path: 'database', component: DatabaseComponent},
{path: 'cache', component: CacheComponent},
{path: 'create-admin', component: CreateAdminComponent},
{path: 'schedule', component: SetupScheduleComponent},
{path: 'logging', component: LoggingComponent},
{path: 'summary', component: SummaryComponent},
{path: '', redirectTo: 'welcome', pathMatch: 'full'}
]
}
/*{path: 'not-found', title: '404 страница не найдена'},
{path: '**', redirectTo: '/not-found'}*/
];

View File

@ -0,0 +1,18 @@
import {EventEmitter, Injectable} from '@angular/core';
import {BehaviorSubject, Observable} from "rxjs";
@Injectable({
providedIn: 'root'
})
export class NavigationService {
private nextButtonState = new BehaviorSubject<boolean>(false);
nextButtonState$ = this.nextButtonState.asObservable();
nextButtonAction!: () => Observable<boolean>;
skipNavigation: EventEmitter<() => Observable<boolean>> = new EventEmitter();
setNextButtonState(state: boolean) {
this.nextButtonState.next(state);
}
}