Pages/shows: refactor and code cleanup

This commit is contained in:
Toast 2025-02-06 10:58:25 +01:00
parent 0d9b378b8e
commit 4db1485259

View file

@ -8,7 +8,6 @@ import {NgbModal, NgbModalRef} from '@ng-bootstrap/ng-bootstrap';
import {CreateEditModalComponent} from '../../components/create-modal/create-edit-modal/create-edit-modal.component'; import {CreateEditModalComponent} from '../../components/create-modal/create-edit-modal/create-edit-modal.component';
import {DatePipe} from '@angular/common'; import {DatePipe} from '@angular/common';
import {DeleteModalComponent} from '../../components/delete-modal/delete-modal.component'; import {DeleteModalComponent} from '../../components/delete-modal/delete-modal.component';
import {ShowsApiDeletionEdit} from '../../interfaces/shows-api-deletion-edit';
@Component({ @Component({
selector: 'app-shows', selector: 'app-shows',
@ -47,10 +46,10 @@ export class ShowsComponent {
createNewShow() { createNewShow() {
this.modalService.open(CreateEditModalComponent).result.then( this.modalService.open(CreateEditModalComponent).result.then(
(result: Show) => { (closeResult: Show) => {
this.shows.push(result) this.shows.push(closeResult)
}, },
(result) => { () => {
// Dismissed, do nothing // Dismissed, do nothing
} }
) )
@ -60,11 +59,11 @@ export class ShowsComponent {
const modal: NgbModalRef = this.modalService.open(DeleteModalComponent) const modal: NgbModalRef = this.modalService.open(DeleteModalComponent)
modal.componentInstance.showName = show.title; modal.componentInstance.showName = show.title;
modal.result.then( modal.result.then(
(result) => { (closeResult) => {
if (result) { if (closeResult) {
if (show._id != null) { if (show._id != null) {
this.api.deleteShw(show._id).subscribe({ this.api.deleteShw(show._id).subscribe({
next: (response: ShowsApiDeletionEdit) => { next: () => {
// Do nothing // Do nothing
}, error: (err: any) => { }, error: (err: any) => {
console.log(err) console.log(err)
@ -77,7 +76,7 @@ export class ShowsComponent {
} }
} }
}, },
(result) => { () => {
// Dismissed, do nothing // Dismissed, do nothing
} }
) )
@ -92,7 +91,8 @@ export class ShowsComponent {
(closeResult: Show) => { (closeResult: Show) => {
this.shows[index] = closeResult this.shows[index] = closeResult
}, },
(dissmissResult) => { () => {
// Dismissed, do nothing
} }
) )
} }