Pages/shows: refactor and code cleanup
This commit is contained in:
parent
0d9b378b8e
commit
4db1485259
1 changed files with 9 additions and 9 deletions
|
|
@ -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 {DatePipe} from '@angular/common';
|
||||
import {DeleteModalComponent} from '../../components/delete-modal/delete-modal.component';
|
||||
import {ShowsApiDeletionEdit} from '../../interfaces/shows-api-deletion-edit';
|
||||
|
||||
@Component({
|
||||
selector: 'app-shows',
|
||||
|
|
@ -47,10 +46,10 @@ export class ShowsComponent {
|
|||
|
||||
createNewShow() {
|
||||
this.modalService.open(CreateEditModalComponent).result.then(
|
||||
(result: Show) => {
|
||||
this.shows.push(result)
|
||||
(closeResult: Show) => {
|
||||
this.shows.push(closeResult)
|
||||
},
|
||||
(result) => {
|
||||
() => {
|
||||
// Dismissed, do nothing
|
||||
}
|
||||
)
|
||||
|
|
@ -60,11 +59,11 @@ export class ShowsComponent {
|
|||
const modal: NgbModalRef = this.modalService.open(DeleteModalComponent)
|
||||
modal.componentInstance.showName = show.title;
|
||||
modal.result.then(
|
||||
(result) => {
|
||||
if (result) {
|
||||
(closeResult) => {
|
||||
if (closeResult) {
|
||||
if (show._id != null) {
|
||||
this.api.deleteShw(show._id).subscribe({
|
||||
next: (response: ShowsApiDeletionEdit) => {
|
||||
next: () => {
|
||||
// Do nothing
|
||||
}, error: (err: any) => {
|
||||
console.log(err)
|
||||
|
|
@ -77,7 +76,7 @@ export class ShowsComponent {
|
|||
}
|
||||
}
|
||||
},
|
||||
(result) => {
|
||||
() => {
|
||||
// Dismissed, do nothing
|
||||
}
|
||||
)
|
||||
|
|
@ -92,7 +91,8 @@ export class ShowsComponent {
|
|||
(closeResult: Show) => {
|
||||
this.shows[index] = closeResult
|
||||
},
|
||||
(dissmissResult) => {
|
||||
() => {
|
||||
// Dismissed, do nothing
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue