import { Component } from "@angular/core" ; import { ActivatedRoute , Router } from "@angular/router" ; import { first } from "rxjs/operators" ; import { FolderService } from "jslib-common/abstractions/folder.service" ; import { I18nService } from "jslib-common/abstractions/i18n.service" ; import { LogService } from "jslib-common/abstractions/log.service" ; import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service" ; import { FolderAddEditComponent as BaseFolderAddEditComponent } from "jslib-angular/components/folder-add-edit.component" ; @ Component ( { selector : "app-folder-add-edit" , templateUrl : "folder-add-edit.component.html" , } ) export class FolderAddEditComponent extends BaseFolderAddEditComponent { constructor ( folderService , i18nService , platformUtilsService , private router , private route , logService ) { super ( folderService , i18nService , platformUtilsService , logService ) ; } async ngOnInit ( ) { this . route . queryParams . pipe ( first ( ) ) . subscribe ( async ( params ) => { if ( params . folderId ) { this . folderId = params . folderId ; } await this . init ( ) ; } ) ; } async submit ( ) { if ( await super . submit ( ) ) { this . router . navigate ( [ "/folders" ] ) ; return true ; } return false ; } async delete ( ) { const confirmed = await super . delete ( ) ; if ( confirmed ) { this . router . navigate ( [ "/folders" ] ) ; } return confirmed ; } }