diff --git a/package-lock.json b/package-lock.json index 77cd379..7ba4429 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,6 +33,8 @@ }, "@angular-devkit/build-angular": { "version": "0.801.3", + "resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-0.801.3.tgz", + "integrity": "sha512-BmN48xepRzQN2h2L7k9MhEWSAmEJj8celtD9Tu9Gn2DeM0yh2TFW9OKFKJlqyF3vGd3at24bqHOXI4MtDeltQQ==", "dev": true, "requires": { "@angular-devkit/architect": "0.801.3", @@ -262,6 +264,8 @@ }, "@angular/animations": { "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-8.1.3.tgz", + "integrity": "sha512-IdWz2EcF+8ZM7LSZ+Kc64RNoLQK7t7hJr+3nKuiTZDncIwMcV3yPn98Jz5BncLNcK0vkYju/hPqnWJgI/0+w6A==", "requires": { "tslib": "^1.9.0" }, @@ -275,6 +279,8 @@ }, "@angular/cdk": { "version": "8.1.4", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-8.1.4.tgz", + "integrity": "sha512-U0tjhAZM4qqUHGGKIKFZZ9d8929s2U/HO0FdoT/eX+oHPOA6mm3bBep7myrSzlkP9V7O1JJfYdhEgijXhYxprQ==", "requires": { "parse5": "^5.0.0", "tslib": "^1.7.1" @@ -295,6 +301,8 @@ }, "@angular/cli": { "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-8.1.3.tgz", + "integrity": "sha512-8BuN+UW1etRGS2U8rnxLagcA/zCxAmrtH6cB943CecPkr3p9+VUlVXtrRU8lkQE/wdrGmJjS5qkG9TybTIPRwg==", "dev": true, "requires": { "@angular-devkit/architect": "0.801.3", @@ -336,6 +344,8 @@ }, "@angular/common": { "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@angular/common/-/common-8.1.3.tgz", + "integrity": "sha512-AnTlYV+Y3HYjJsAIt2AkIJ63qphvu9RNIJSZS61zQ4YBty29aslAJ/jh3PSWD0Yj9UT/AgzquJhfhhNEuImDRw==", "requires": { "tslib": "^1.9.0" }, @@ -349,6 +359,8 @@ }, "@angular/compiler": { "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-8.1.3.tgz", + "integrity": "sha512-mKeRkpPy/iBPGBCVQIPF9x4f1S68ilEYaQTTfHoLR0OfivEQsyGuf2GEegwbTosEBX3JF+0JHfCNvsAE1zI5Og==", "requires": { "tslib": "^1.9.0" }, @@ -362,6 +374,8 @@ }, "@angular/compiler-cli": { "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-8.1.3.tgz", + "integrity": "sha512-rzlKU/xo6AzSPBLnJ/jeSwgojn/MaByTaGFG4THLRUizfGPqAsmppQ12Nmqr9faIiuG0k/izGSoWmppCJEK8FA==", "dev": true, "requires": { "canonical-path": "1.0.0", @@ -386,6 +400,8 @@ }, "@angular/core": { "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@angular/core/-/core-8.1.3.tgz", + "integrity": "sha512-45ocymDkXhmgluhaIX/O6IgqGPCLOlSYEXYpJ660QS1JgprKU7Ae9mWiNSmbBmT0OGV/sKKF8SNMQAGOHgio6Q==", "requires": { "tslib": "^1.9.0" }, @@ -399,6 +415,8 @@ }, "@angular/forms": { "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-8.1.3.tgz", + "integrity": "sha512-NabNiUsR1XgrI1/T8hFwbTH0BMqhKd1riSTU+xyJ3qVbdmORq1xnf6/dLbljNGxViMU28P8hBXvyf1BoTS+HyQ==", "requires": { "tslib": "^1.9.0" }, @@ -412,10 +430,14 @@ }, "@angular/language-service": { "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@angular/language-service/-/language-service-8.1.3.tgz", + "integrity": "sha512-9s2LWlRlBhUXZ0oWh5ojYKnQgXgYH/VifEXteRWmEJ0dlwDApgw5Jk6usstDhv09XQvLdoumMQwOXf07zjcJrQ==", "dev": true }, "@angular/material": { "version": "8.1.4", + "resolved": "https://registry.npmjs.org/@angular/material/-/material-8.1.4.tgz", + "integrity": "sha512-HV1qU63MaOtAc+cWg21Y2ygQKdEDjsGQ/3d3qym9sfR0xU2vvY7OG6gH48BfPeU63oMYxQkhxfoGP8wWMXSU1w==", "requires": { "tslib": "^1.7.1" }, @@ -429,6 +451,8 @@ }, "@angular/platform-browser": { "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-8.1.3.tgz", + "integrity": "sha512-ihjoJd3OCmn/LBpYEDeCYnYJ1JRzeY6xYySNBEHNHLc07FX0TTiNwiZJHjbKoxdjr7qe6cj6gpT51M77pRlKKw==", "requires": { "tslib": "^1.9.0" }, @@ -442,6 +466,8 @@ }, "@angular/platform-browser-dynamic": { "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-8.1.3.tgz", + "integrity": "sha512-tsZWp8aFZNvbJ1TgP75GEfrwLe4SFW02kzEF12o7XlGU/iwnMjEs356rGHeueJZuWMFGS8PLL4mqPic7R5p53Q==", "requires": { "tslib": "^1.9.0" }, @@ -455,6 +481,8 @@ }, "@angular/router": { "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@angular/router/-/router-8.1.3.tgz", + "integrity": "sha512-MOalKqqWcTaosHLNE5nmk5rsLRp3jE1PobGaFtbUJKTTZW0vS4rcr6iiRg2bZRv/srGixDXvNLenvYjTpzzTdw==", "requires": { "tslib": "^1.9.0" }, @@ -710,6 +738,8 @@ }, "@types/jasminewd2": { "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/jasminewd2/-/jasminewd2-2.0.6.tgz", + "integrity": "sha512-2ZOKrxb8bKRmP/po5ObYnRDgFE4i+lQiEB27bAMmtMWLgJSqlIDqlLx6S0IRorpOmOPRQ6O80NujTmQAtBkeNw==", "dev": true, "requires": { "@types/jasmine": "*" @@ -1050,6 +1080,8 @@ }, "angular-epic-spinners": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/angular-epic-spinners/-/angular-epic-spinners-2.0.0.tgz", + "integrity": "sha512-+OElE3Vb0A555DcRh44LpHuYxdoTKFsOkVCFubFBt4FexYLaPuyzY0qGL566C2Y/i0cFmcl+CNcKvX1SuVp0Ig==", "requires": { "tslib": "^1.9.0" }, @@ -2294,6 +2326,8 @@ }, "codelyzer": { "version": "5.1.0", + "resolved": "https://registry.npmjs.org/codelyzer/-/codelyzer-5.1.0.tgz", + "integrity": "sha512-QiyY2/oDQnYx4mAVEDqr+z9MwrOto18tQFjExiuRChXCy0yvngS5fQpWIxvAGpbOmZFiR1PRTRLbEI71u10maA==", "dev": true, "requires": { "app-root-path": "^2.2.1", @@ -4503,7 +4537,9 @@ "dev": true }, "hammerjs": { - "version": "2.0.8" + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz", + "integrity": "sha1-BO93hiz/K7edMPdpIJWTAiK/YPE=" }, "handle-thing": { "version": "2.0.0", @@ -5512,6 +5548,8 @@ }, "jasmine-spec-reporter": { "version": "4.2.1", + "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-4.2.1.tgz", + "integrity": "sha512-FZBoZu7VE5nR7Nilzy+Np8KuVIOxF4oXDPDknehCYBDE080EnlPu0afdZNmpGDBRCUBv3mj5qgqCRmk6W/K8vg==", "dev": true, "requires": { "colors": "1.1.2" @@ -5631,6 +5669,8 @@ }, "karma": { "version": "4.1.0", + "resolved": "https://registry.npmjs.org/karma/-/karma-4.1.0.tgz", + "integrity": "sha512-xckiDqyNi512U4dXGOOSyLKPwek6X/vUizSy2f3geYevbLj+UIdvNwbn7IwfUIL2g1GXEPWt/87qFD1fBbl/Uw==", "dev": true, "requires": { "bluebird": "^3.3.0", @@ -5678,6 +5718,8 @@ }, "karma-chrome-launcher": { "version": "2.2.0", + "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz", + "integrity": "sha512-uf/ZVpAabDBPvdPdveyk1EPgbnloPvFFGgmRhYLTDH7gEB4nZdSBk8yTU47w1g/drLSx5uMOkjKk7IWKfWg/+w==", "dev": true, "requires": { "fs-access": "^1.0.0", @@ -5686,6 +5728,8 @@ }, "karma-coverage-istanbul-reporter": { "version": "2.0.6", + "resolved": "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-2.0.6.tgz", + "integrity": "sha512-WFh77RI8bMIKdOvI/1/IBmgnM+Q7NOLhnwG91QJrM8lW+CIXCjTzhhUsT/svLvAkLmR10uWY4RyYbHMLkTglvg==", "dev": true, "requires": { "istanbul-api": "^2.1.6", @@ -5694,6 +5738,8 @@ }, "karma-jasmine": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-2.0.1.tgz", + "integrity": "sha512-iuC0hmr9b+SNn1DaUD2QEYtUxkS1J+bSJSn7ejdEexs7P8EYvA1CWkEdrDQ+8jVH3AgWlCNwjYsT1chjcNW9lA==", "dev": true, "requires": { "jasmine-core": "^3.3" @@ -5701,6 +5747,8 @@ }, "karma-jasmine-html-reporter": { "version": "1.4.2", + "resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-1.4.2.tgz", + "integrity": "sha512-7g0gPj8+9JepCNJR9WjDyQ2RkZ375jpdurYQyAYv8PorUCadepl8vrD6LmMqOGcM17cnrynBawQYZHaumgDjBw==", "dev": true }, "karma-source-map-support": { @@ -7121,6 +7169,8 @@ }, "protractor": { "version": "5.4.2", + "resolved": "https://registry.npmjs.org/protractor/-/protractor-5.4.2.tgz", + "integrity": "sha512-zlIj64Cr6IOWP7RwxVeD8O4UskLYPoyIcg0HboWJL9T79F1F0VWtKkGTr/9GN6BKL+/Q/GmM7C9kFVCfDbP5sA==", "dev": true, "requires": { "@types/q": "^0.0.32", @@ -7742,6 +7792,14 @@ "aproba": "^1.1.1" } }, + "rxjs": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.4.0.tgz", + "integrity": "sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw==", + "requires": { + "tslib": "^1.9.0" + } + }, "safe-buffer": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", @@ -9193,6 +9251,8 @@ }, "ts-node": { "version": "7.0.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz", + "integrity": "sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==", "dev": true, "requires": { "arrify": "^1.0.0", @@ -9205,8 +9265,15 @@ "yn": "^2.0.0" } }, + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" + }, "tslint": { "version": "5.15.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.15.0.tgz", + "integrity": "sha512-6bIEujKR21/3nyeoX2uBnE8s+tMXCQXhqMmaIPJpHmXJoBJPTLcI7/VHRtUwMhnLVdwLqqY3zmd8Dxqa5CVdJA==", "dev": true, "requires": { "babel-code-frame": "^6.22.0", @@ -10163,7 +10230,9 @@ "dev": true }, "zone.js": { - "version": "0.9.1" + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.9.1.tgz", + "integrity": "sha512-GkPiJL8jifSrKReKaTZ5jkhrMEgXbXYC+IPo1iquBjayRa0q86w3Dipjn8b415jpitMExe9lV8iTsv8tk3DGag==" } } } diff --git a/src/app/modules/home/components/home/home.component.html b/src/app/modules/home/components/home/home.component.html index 6c1b74b..0add6b6 100644 --- a/src/app/modules/home/components/home/home.component.html +++ b/src/app/modules/home/components/home/home.component.html @@ -1,7 +1,7 @@

Welcome to VideoGamer

-
Explore gaming world.
+
Discover your new favorite game.
diff --git a/src/app/modules/home/components/home/home.component.ts b/src/app/modules/home/components/home/home.component.ts index 3ac34ca..52b1f9a 100644 --- a/src/app/modules/home/components/home/home.component.ts +++ b/src/app/modules/home/components/home/home.component.ts @@ -2,8 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { LoadingService } from '@service/loading/loading.service'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; -import { TeamsService } from '@serviceteams/teams.service'; import { Subscription } from 'rxjs'; +import { GamesService } from '@service/games/games.service'; @Component({ selector: 'app-home', templateUrl: './home.component.html', @@ -16,14 +16,14 @@ export class HomeComponent implements OnInit { private readonly titleService: Title, private readonly loadingService: LoadingService, private readonly snackBar: MatSnackBar, - private readonly teamsService: TeamsService + private readonly gamesService: GamesService ) {} ngOnInit(): void { this.loadingService.setLoading(true); this.titleService.setTitle('VideoGamer | Home'); this.openSnackBar(); - this.subscription = this.teamsService.find(5).subscribe(data => { + this.subscription = this.gamesService.all().subscribe(data => { console.log(data); }); } @@ -32,12 +32,10 @@ export class HomeComponent implements OnInit { const options: MatSnackBarConfig = { direction: 'ltr', duration: 4000, - horizontalPosition: 'end', - panelClass: ['example-pizza-party'] + horizontalPosition: 'end' }; - this.snackBar.open('Welcome to the best NBA analytics app. 👋', 'Dismiss', options); - // this.snackBar.openFromComponent(NotificationComponent, options); + this.snackBar.open('Welcome 👋', null, options); } onClick(): void { diff --git a/src/app/modules/home/home.module.ts b/src/app/modules/home/home.module.ts index a0ef25d..11ce274 100644 --- a/src/app/modules/home/home.module.ts +++ b/src/app/modules/home/home.module.ts @@ -8,7 +8,7 @@ import { MatInputModule } from '@angular/material/input'; import { MatSnackBarModule } from '@angular/material/snack-bar'; import { NotificationComponent } from '../shared-components/components/notification/notification.component'; import { SharedModule } from '../shared/shared.module'; -import { TeamsService } from '@serviceteams/teams.service'; +import { GamesService } from '@service/games/games.service'; const routes: Routes = [ { @@ -39,6 +39,6 @@ const routes: Routes = [ SharedModule ], entryComponents: [NotificationComponent], - providers: [TeamsService] + providers: [GamesService] }) export class HomeModule {} diff --git a/src/app/modules/shared-components/components/header/header.component.ts b/src/app/modules/shared-components/components/header/header.component.ts index da7e2de..7503b2c 100644 --- a/src/app/modules/shared-components/components/header/header.component.ts +++ b/src/app/modules/shared-components/components/header/header.component.ts @@ -13,7 +13,7 @@ export interface Link { export class HeaderComponent implements OnInit { public readonly links: Link[] = [ { name: 'Home', path: '' }, - { name: 'About', path: 'about' }, + { name: 'Gaming', path: 'gaming' }, { name: 'Contact', path: 'contact' } ]; constructor() {} diff --git a/src/app/modules/shared/models/Game.ts b/src/app/modules/shared/models/Game.ts index a30cbd1..fe9b8ec 100644 --- a/src/app/modules/shared/models/Game.ts +++ b/src/app/modules/shared/models/Game.ts @@ -1,3 +1,7 @@ -export interface Game { +import { Team } from '@model/Team'; +export interface Game { + id: number; + date: Date; + homeTeam: Team; } diff --git a/src/app/modules/shared/models/Player.ts b/src/app/modules/shared/models/Player.ts index 5bdd632..2c7d379 100644 --- a/src/app/modules/shared/models/Player.ts +++ b/src/app/modules/shared/models/Player.ts @@ -1,7 +1,12 @@ +import { Team } from '@model/Team'; + export interface Player { id: number; + firstName: string; + lastName: string; position: string; - height: string; - weight: string; - club: string; + heightFeet: number; + height_inches: number; + weightPounds: string; + team: Team; } diff --git a/src/app/modules/shared/models/a.json b/src/app/modules/shared/models/a.json new file mode 100644 index 0000000..1d5dff4 --- /dev/null +++ b/src/app/modules/shared/models/a.json @@ -0,0 +1,29 @@ +{ + "id": 3, + "date": "2018-10-17 00:00:00 UTC", + "home_team": { + "id": 4, + "abbreviation": "CHA", + "city": "Charlotte", + "conference": "East", + "division": "Southeast", + "full_name": "Charlotte Hornets", + "name": "Hornets" + }, + "home_team_score": 112, + "period": 4, + "postseason": false, + "season": 2018, + "status": "Final", + "time": " ", + "visitor_team": { + "id": 17, + "abbreviation": "MIL", + "city": "Milwaukee", + "conference": "East", + "division": "Central", + "full_name": "Milwaukee Bucks", + "name": "Bucks" + }, + "visitor_team_score": 113 +} diff --git a/src/app/modules/shared/services/IApiResource.ts b/src/app/modules/shared/services/IApiResource.ts index 6460455..b3e5f71 100644 --- a/src/app/modules/shared/services/IApiResource.ts +++ b/src/app/modules/shared/services/IApiResource.ts @@ -3,5 +3,5 @@ import { Observable } from 'rxjs'; export interface IApiResource { readonly resourcePath: string; all(): Observable; - find(id: number): Observable; + find(id: string): Observable; } diff --git a/src/app/modules/shared/services/games/games.service.ts b/src/app/modules/shared/services/games/games.service.ts index ad6db5b..de470f7 100644 --- a/src/app/modules/shared/services/games/games.service.ts +++ b/src/app/modules/shared/services/games/games.service.ts @@ -4,7 +4,6 @@ import { IApiResource } from '@service/IApiResource'; import { Game } from '@model/Game'; import { Observable } from 'rxjs'; import { environment } from '../../../../../environments/environment'; -import { apiHttpHeaders } from '@serviceApiHttpHeaders'; import { map } from 'rxjs/operators'; @Injectable({ @@ -16,14 +15,10 @@ export class GamesService implements IApiResource { constructor(private readonly http: HttpClient) {} public all(): Observable { - return this.http.get<{ data: Game[] }>(this.resourcePath, apiHttpHeaders).pipe( - map(response => { - return response.data; - }) - ); + return this.http.get<{ results: Game[] }>(this.resourcePath).pipe(map(response => response.results)); } - public find(id: number): Observable { - return this.http.get(`${this.resourcePath}/${id}`, apiHttpHeaders); + public find(gameSlug: string): Observable { + return this.http.get(`${this.resourcePath}/${gameSlug}`); } } diff --git a/src/app/modules/shared/services/players/players.service.spec.ts b/src/app/modules/shared/services/players/players.service.spec.ts new file mode 100644 index 0000000..383dbdb --- /dev/null +++ b/src/app/modules/shared/services/players/players.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { PlayersService } from './players.service'; + +describe('PlayersService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: PlayersService = TestBed.get(PlayersService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/modules/shared/services/players/players.service.ts b/src/app/modules/shared/services/players/players.service.ts new file mode 100644 index 0000000..d934c5f --- /dev/null +++ b/src/app/modules/shared/services/players/players.service.ts @@ -0,0 +1,25 @@ +import { Injectable } from '@angular/core'; +import { IApiResource } from '@serviceIApiResource'; +import { Player } from '@model/Player'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { apiHttpHeaders } from '@serviceApiHttpHeaders'; +import { map } from 'rxjs/operators'; +import { environment } from 'environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class PlayersService { + public readonly resourcePath: string = `${environment.apiUrl}/players`; + + constructor(private readonly http: HttpClient) {} + + public all(): Observable { + return this.http.get<{ data: Player[] }>(this.resourcePath, apiHttpHeaders).pipe(map(response => response.data)); + } + + public find(id: number): Observable { + return this.http.get(`${this.resourcePath}/${id}`, apiHttpHeaders); + } +} diff --git a/src/app/modules/shared/services/stats/stats.service.spec.ts b/src/app/modules/shared/services/stats/stats.service.spec.ts new file mode 100644 index 0000000..79a11f6 --- /dev/null +++ b/src/app/modules/shared/services/stats/stats.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { StatsService } from './stats.service'; + +describe('StatsService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: StatsService = TestBed.get(StatsService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/modules/shared/services/stats/stats.service.ts b/src/app/modules/shared/services/stats/stats.service.ts new file mode 100644 index 0000000..db9e7a7 --- /dev/null +++ b/src/app/modules/shared/services/stats/stats.service.ts @@ -0,0 +1,9 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class StatsService { + + constructor() { } +} diff --git a/src/app/modules/shared/services/teams/teams.service.ts b/src/app/modules/shared/services/teams/teams.service.ts index 422fe82..f2471dc 100644 --- a/src/app/modules/shared/services/teams/teams.service.ts +++ b/src/app/modules/shared/services/teams/teams.service.ts @@ -9,20 +9,16 @@ import { apiHttpHeaders } from '@service/ApiHttpHeaders'; @Injectable({ providedIn: 'root' }) -export class TeamsService implements IApiResource { +export class TeamsService { public readonly resourcePath: string = `${environment.apiUrl}/teams`; constructor(private readonly http: HttpClient) {} public all(): Observable { - return this.http.get<{ data: Team[] }>(this.resourcePath, apiHttpHeaders).pipe( - map(response => { - return response.data; - }) - ); - } + return this.http.get<{ data: Team[] }>(this.resourcePath, apiHttpHeaders).pipe(map(response => response.data)); + } - public find(id: number): Observable { - return this.http.get(`${this.resourcePath}/${id}`, apiHttpHeaders); - } + public find(id: string): Observable { + return this.http.get(`${this.resourcePath}/${id}`, apiHttpHeaders); + } } diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 5de311f..1270e04 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -2,7 +2,8 @@ import { IEnvironment } from './environment.interface'; export const environment: IEnvironment = { production: true, - apiUrl: 'https://free-nba.p.rapidapi.com', + apiUrl: 'https://api.rawg.io/api', + //https://api.rawg.io/api/games?page_size=5&search=gta%20v xRapidApiKey: 'aolN7ZvMgZmsh4QEr4r3ghUrDjIyp12Y5zejsnbDZaxGht72JT', xRapidApiHost: 'free-nba.p.rapidapi.com' }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 64de529..b017876 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -6,7 +6,7 @@ import { IEnvironment } from './environment.interface'; export const environment: IEnvironment = { production: false, - apiUrl: 'https://free-nba.p.rapidapi.com', + apiUrl: 'https://api.rawg.io/api', xRapidApiKey: 'aolN7ZvMgZmsh4QEr4r3ghUrDjIyp12Y5zejsnbDZaxGht72JT', xRapidApiHost: 'free-nba.p.rapidapi.com' };