Components/create-modal: show toast and close on good creation
This commit is contained in:
parent
891b6c2e92
commit
e0fd189860
1 changed files with 7 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
|
|||
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
|
||||
import {ShowsApiService} from '../../../services/shows/shows-api.service';
|
||||
import {ShowsApiCreation} from '../../../interfaces/shows-api-creation';
|
||||
import {ToastService} from '../../../services/toast/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-create-modal',
|
||||
|
|
@ -15,6 +16,7 @@ import {ShowsApiCreation} from '../../../interfaces/shows-api-creation';
|
|||
export class CreateModalComponent {
|
||||
private activeModal = inject(NgbActiveModal)
|
||||
private showsService = inject(ShowsApiService)
|
||||
private toastService = inject(ToastService)
|
||||
protected newShowForm: FormGroup
|
||||
|
||||
constructor() {
|
||||
|
|
@ -47,7 +49,11 @@ export class CreateModalComponent {
|
|||
}, error: (err: any) => {
|
||||
console.error(err)
|
||||
}, complete: () => {
|
||||
console.log("Sent")
|
||||
this.toastService.show({
|
||||
body: "Show added successfully!",
|
||||
htmlClass: "bg-success text-light"
|
||||
})
|
||||
this.activeModal.close()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue