-
{{ show.title }}
-
{{ show.date | date }}
-
-
+
+
+
+
+
{{ show.title }}
+
{{ show.date | date }}
+
+
+
}
diff --git a/src/pages/shows/shows.component.ts b/src/pages/shows/shows.component.ts
index 6c1eefb..65cd046 100644
--- a/src/pages/shows/shows.component.ts
+++ b/src/pages/shows/shows.component.ts
@@ -1,11 +1,11 @@
import {Component, inject} from '@angular/core';
import {ShowsApiService} from '../../services/shows/shows-api.service';
import {Show} from '../../interfaces/show';
-import {ShowsApiResponse} from '../../interfaces/shows-api-response';
+import {ApiResponse} from '../../interfaces/api-response';
import {Toast} from '../../interfaces/toast';
import {ToastService} from '../../services/toast/toast.service';
import {NgbModal, NgbModalRef} from '@ng-bootstrap/ng-bootstrap';
-import {CreateEditModalComponent} from '../../components/create-modal/create-edit-modal/create-edit-modal.component';
+import {CreateEditModalComponent} from '../../components/create-edit-modal/create-edit-modal.component';
import {DatePipe} from '@angular/common';
import {DeleteModalComponent} from '../../components/delete-modal/delete-modal.component';
@@ -29,8 +29,8 @@ export class ShowsComponent {
let loadToast: Toast = {body: "Loading shows..."};
this.toastService.show(loadToast);
this.api.getShows().subscribe({
- next: (response: ShowsApiResponse) => {
- this.shows = response.shows;
+ next: (response: ApiResponse) => {
+ this.shows = response.shows ?? [];
}, error: (err: any) => {
console.error("Error: ", err);
}, complete: () => {
diff --git a/src/services/genres/genres.service.spec.ts b/src/services/genres/genres.service.spec.ts
new file mode 100644
index 0000000..8d71cf8
--- /dev/null
+++ b/src/services/genres/genres.service.spec.ts
@@ -0,0 +1,16 @@
+import {TestBed} from '@angular/core/testing';
+
+import {GenresService} from './genres.service';
+
+describe('GenresService', () => {
+ let service: GenresService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(GenresService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/services/genres/genres.service.ts b/src/services/genres/genres.service.ts
new file mode 100644
index 0000000..c8e1c7f
--- /dev/null
+++ b/src/services/genres/genres.service.ts
@@ -0,0 +1,40 @@
+import {inject, Injectable} from '@angular/core';
+import {HttpClient} from '@angular/common/http';
+import {Observable} from 'rxjs';
+import {ApiResponse} from '../../interfaces/api-response';
+import {ApiIdResponse} from '../../interfaces/api-id-response';
+import {Show} from '../../interfaces/show';
+import {ApiCreationResponse} from '../../interfaces/api-creation-response';
+import {ApiDeletionEditResponse} from '../../interfaces/api-deletion-edit-response';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class GenresService {
+
+ private readonly url: string = "https://shows.toast003.xyz/api/";
+ private genresEndpoint: string
+ private idEndpoint: string
+ private http: HttpClient = inject(HttpClient);
+
+ constructor() {
+ this.genresEndpoint = this.url + "genres/"
+ this.idEndpoint = this.genresEndpoint + "id/"
+ }
+
+ getGenres(): Observable
{
+ return this.http.get(this.genresEndpoint)
+ }
+
+ getGenre(id: string): Observable {
+ return this.http.get(this.idEndpoint + id)
+ }
+
+ sendGenre(newShow: Show): Observable {
+ return this.http.post(this.genresEndpoint, newShow)
+ }
+
+ updateGenre(show: Show): Observable {
+ return this.http.put(this.idEndpoint + show._id, show)
+ }
+}
diff --git a/src/services/shows/shows-api.service.ts b/src/services/shows/shows-api.service.ts
index c8c91d9..36c46c3 100644
--- a/src/services/shows/shows-api.service.ts
+++ b/src/services/shows/shows-api.service.ts
@@ -1,18 +1,18 @@
import {inject, Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';
-import {ShowsApiResponse} from '../../interfaces/shows-api-response';
-import {ShowsApiCreation} from '../../interfaces/shows-api-creation';
-import {ShowsApiIdResponse} from '../../interfaces/shows-api-id-response';
-import {ShowsApiDeletionEdit} from '../../interfaces/shows-api-deletion-edit';
+import {ApiResponse} from '../../interfaces/api-response';
+import {ApiIdResponse} from '../../interfaces/api-id-response';
+import {ApiDeletionEditResponse} from '../../interfaces/api-deletion-edit-response';
import {Show} from '../../interfaces/show';
+import {ApiCreationResponse} from '../../interfaces/api-creation-response';
@Injectable({
providedIn: 'root'
})
export class ShowsApiService {
- private readonly url: string = "https://shows.everest.tailscale/api/";
+ private readonly url: string = "https://shows.toast003.xyz/api/";
private showsEndpoint: string
private idEndpoint: string
private http: HttpClient = inject(HttpClient);
@@ -22,23 +22,23 @@ export class ShowsApiService {
this.idEndpoint = this.showsEndpoint + "id/"
}
- getShows(): Observable {
- return this.http.get(this.showsEndpoint)
+ getShows(): Observable {
+ return this.http.get(this.showsEndpoint)
}
- getShow(id: string): Observable {
- return this.http.get(this.idEndpoint + id)
+ getShow(id: string): Observable {
+ return this.http.get(this.idEndpoint + id)
}
- sendShow(newShow: Show): Observable {
- return this.http.post(this.showsEndpoint, newShow)
+ sendShow(newShow: Show): Observable {
+ return this.http.post(this.showsEndpoint, newShow)
}
- deleteShw(id: string): Observable {
- return this.http.delete(this.idEndpoint + id)
+ deleteShw(id: string): Observable {
+ return this.http.delete(this.idEndpoint + id)
}
- updateShow(show: Show): Observable {
- return this.http.put(this.idEndpoint + show._id, show)
+ updateShow(show: Show): Observable {
+ return this.http.put(this.idEndpoint + show._id, show)
}
}