Pages/shows: add new show to list on creation
This commit is contained in:
parent
8a2fbcf43e
commit
193944d55b
1 changed files with 15 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import {ToastService} from '../../services/toast/toast.service';
|
|||
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
|
||||
import {CreateModalComponent} from '../../components/create-modal/create-modal/create-modal.component';
|
||||
import {DatePipe} from '@angular/common';
|
||||
import {ShowsApiIdResponse} from '../../interfaces/shows-api-id-response';
|
||||
|
||||
@Component({
|
||||
selector: 'app-shows',
|
||||
|
|
@ -42,6 +43,19 @@ export class ShowsComponent {
|
|||
}
|
||||
|
||||
createNewShow() {
|
||||
this.modalService.open(CreateModalComponent)
|
||||
this.modalService.open(CreateModalComponent).result.then(
|
||||
(result) => {
|
||||
console.log(`Result: ${result}`)
|
||||
|
||||
this.api.getShow(result).subscribe({
|
||||
next: (response: ShowsApiIdResponse) => {
|
||||
console.log(response.show)
|
||||
this.shows.push(response.show)
|
||||
}, error: (err: any) => {
|
||||
console.error(`Error: ${err}`)
|
||||
}, complete: () => {}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue