Commit ed45d4a5 authored by Dennis Willers's avatar Dennis Willers
Browse files

Durchstich zur Middleware - Datenbankverbindung

Fehlerfix, bzw. so das die App wieder läuft
parent 7c9f731f
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
import { BrowserModule } from '@angular/platform-browser';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';


import { AppRoutingModule } from './app-routing.module';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { AppComponent } from './app.component';
@@ -27,6 +28,7 @@ import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
    ErrorComponent,
    ErrorComponent,
  ],
  ],
  imports: [
  imports: [
    HttpClientModule,
    BrowserModule,
    BrowserModule,
    AppRoutingModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    BrowserAnimationsModule,
+32 −0
Original line number Original line Diff line number Diff line
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from '../../environments/environment';

@Injectable({
  providedIn: 'root'
})
export class TabuMiddlewareService {

  constructor(private http: HttpClient) {
  }

  private async request(method: string, url: string, data?: any): Promise<any> {

    const result = this.http.request(method, url, {
      body: data,
      responseType: 'json',
      observe: 'body',
    });
    return new Promise((resolve, reject) => {
      result.subscribe(resolve, reject);
    });
  }

  getSpielSessions(): Promise<any> {
    return this.request('GET', `${environment.tabuMiddlewareURL}SpielSession`);
  }

  addSpielSession(event: any): Promise<any> {
    return this.request('POST', `${environment.tabuMiddlewareURL}addSpielSession`, event);
  }
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -3,7 +3,7 @@
    Leider konnte die Seite nicht erreicht werden, bitte überprüfen Sie den Link oder kehren Sie auf die <a href="router.navigate(['/overview'])">Startseite</a>  zurück
    Leider konnte die Seite nicht erreicht werden, bitte überprüfen Sie den Link oder kehren Sie auf die <a href="router.navigate(['/overview'])">Startseite</a>  zurück
  </h3>
  </h3>
  <br>
  <br>
  <mat-progress-spinner color="primary" mode="mode" value="value">
  <mat-progress-spinner color="primary" mode="determinate" value="value">
  </mat-progress-spinner>
  </mat-progress-spinner>
</div>
</div>


+1 −3
Original line number Original line Diff line number Diff line
@@ -7,8 +7,7 @@
    <mat-card-title>Spielstand</mat-card-title>
    <mat-card-title>Spielstand</mat-card-title>
    <mat-card-content>
    <mat-card-content>
      <br>
      <br>
      <center>
      <table style="align-self: center; align-content: center; align-items: center">
        <table>
        <tr>
        <tr>
          <th>Team rot</th>
          <th>Team rot</th>
          <th>Team blau</th>
          <th>Team blau</th>
@@ -18,7 +17,6 @@
          <th>0</th>
          <th>0</th>
        </tr>
        </tr>
      </table>
      </table>
      </center>
    </mat-card-content>
    </mat-card-content>
    <mat-card-actions>
    <mat-card-actions>
      <br>
      <br>
+4 −2
Original line number Original line Diff line number Diff line
<div style="text-align: center; margin-left: 15em; margin-right: 15em; margin-top: 5em;">
<div style="text-align: center; margin-left: 15em; margin-right: 15em; margin-top: 5em;">
  <mat-card class="transparent">
    <h1>Willkommen bei Tabu im Online-Multiplayer-Modus</h1>
    <h1>Willkommen bei Tabu im Online-Multiplayer-Modus</h1>
    <h2>Ideal im Lockdown!</h2>
    <h2>Ideal im Lockdown!</h2>
  </mat-card>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <mat-card>
  <mat-card class="transparent">
    <mat-card-title>Spielsuche</mat-card-title>
    <mat-card-title>Spielsuche</mat-card-title>
    <mat-card-subtitle>Finde ein Spiel über den Spielnamen oder erstelle ein neues</mat-card-subtitle>
    <mat-card-subtitle>Finde ein Spiel über den Spielnamen oder erstelle ein neues</mat-card-subtitle>
    <mat-card-content>
    <mat-card-content>
@@ -16,7 +18,7 @@
      </form>
      </form>
    </mat-card-content>
    </mat-card-content>
    <mat-card-actions>
    <mat-card-actions>
      <button mat-raised-button color="primary">Spiel erstellen</button>
      <button mat-raised-button color="primary" (click)="getSpielSessions()">Spiel erstellen</button>
      <button mat-raised-button color="primary" (click)="joinGame($event)">Spiel beitreten</button>
      <button mat-raised-button color="primary" (click)="joinGame($event)">Spiel beitreten</button>
    </mat-card-actions>
    </mat-card-actions>
  </mat-card>
  </mat-card>
Loading