diff --git a/src/app/components/show-form/show-form.component.ts b/src/app/components/show-form/show-form.component.ts index e963cc5..09570e8 100644 --- a/src/app/components/show-form/show-form.component.ts +++ b/src/app/components/show-form/show-form.component.ts @@ -3,6 +3,7 @@ import {ShowService} from '../../services/show.service'; import {Show} from '../../model/show'; import {FormsModule} from '@angular/forms'; import {Observable} from 'rxjs'; +import {addDoc, collection, Firestore} from '@angular/fire/firestore'; @Component({ selector: 'app-show-form', @@ -14,13 +15,12 @@ import {Observable} from 'rxjs'; styleUrl: './show-form.component.css' }) export class ShowFormComponent { - showService: ShowService = inject(ShowService); + fireStore: Firestore = inject(Firestore); + private seriesCollection = 'table_show'; show: Show = new Show(0, ""); - shows: Observable = this.showService.getShows(); save() { - // this.shows.push(this.show); - - this.show = new Show(0, ""); + const showsRef = collection(this.fireStore, this.seriesCollection); + addDoc(showsRef, {id: this.show.uid, title: this.show.title,}); } }