From 5f7968a7561fb8ab3dbcf5158a88922090425aa9 Mon Sep 17 00:00:00 2001
From: Phan Huy Tran
Date: Wed, 20 Nov 2024 12:39:45 +0100
Subject: [PATCH] add shows
---
src/app/components/show-form/show-form.component.ts | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
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,});
}
}