37 lines
882 B
TypeScript
37 lines
882 B
TypeScript
import {Component,OnInit} from '@angular/core';
|
|
import {PagesService} from "@app/_services/pages.service";
|
|
import {Subscription} from "rxjs";
|
|
|
|
@Component({
|
|
selector: 'edit-switch',
|
|
templateUrl: 'edit-switch.component.html',
|
|
styleUrls: ['edit-switch.component.scss']
|
|
})
|
|
export class EditSwitch implements OnInit {
|
|
public editMode = false;
|
|
public editable:string;
|
|
|
|
constructor(
|
|
private pagesService: PagesService,
|
|
// private subscription: Subscription
|
|
) {}
|
|
|
|
ngOnInit(){
|
|
console.log('es',this.pagesService.currentPage)
|
|
this.pagesService.currentPage.subscribe( page =>{
|
|
console.log('PAGE',page)
|
|
this.editable = page.permissions?.edit || page.permissions?.anything;
|
|
});
|
|
this.pagesService.editMode.subscribe(
|
|
editMode => this.editMode = editMode
|
|
)
|
|
}
|
|
|
|
|
|
toggle(){
|
|
this.pagesService.editMode.next(!this.editMode)
|
|
}
|
|
|
|
|
|
}
|