mirror of
https://github.com/Wessel/nhl-setgame.git
synced 2026-06-06 00:05:42 +02:00
chore(frontend): Update dependency injection to use latest style
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Router } from '@angular/router';
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { UserDataService } from '../../service/user/user-data.service';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
@@ -11,7 +11,10 @@ import { CommonModule } from '@angular/common';
|
||||
})
|
||||
export class GameListComponent {
|
||||
games: { id: number, startedAt: Date, finishedAt: Date | null, fails: number, hand: any[], deck: any[] }[] | undefined;
|
||||
constructor(public userService: UserDataService, private router: Router) { this.getGames() }
|
||||
userService: UserDataService = inject(UserDataService);
|
||||
router: Router = inject(Router);
|
||||
|
||||
constructor() { this.getGames() }
|
||||
|
||||
async getGames() {
|
||||
this.games = await this.userService.getGames();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { GameService } from '../../service/game/game.service';
|
||||
import { Card } from '../models/card';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@@ -15,8 +15,11 @@ import { ActivatedRoute, UrlSegment, Router } from '@angular/router';
|
||||
export class GameComponent {
|
||||
gameId: string = '';
|
||||
hint: Card[] = []
|
||||
gameService: GameService = inject(GameService);
|
||||
route: ActivatedRoute = inject(ActivatedRoute);
|
||||
router: Router = inject(Router);
|
||||
|
||||
constructor(public gameService: GameService, private route: ActivatedRoute, private router: Router) {
|
||||
constructor() {
|
||||
this.route.params.subscribe(params => {
|
||||
this.gameId = params['id'];
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Card, toCard } from '../../app/models/card';
|
||||
// todo: Rewrite to use angular http client instead of axios, supports always sending tokens
|
||||
import axios from 'axios';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
|
||||
Reference in New Issue
Block a user