From a8c050790da92cb0b0bf4a0ca4e4fbea17eacc2e Mon Sep 17 00:00:00 2001 From: Danijel Anđelković Date: Wed, 13 Apr 2022 22:14:47 +0200 Subject: Dodao hvatanje notifikacija o treniranoj epohi / procesovanom datasetu na frontendu. --- frontend/src/app/_services/signal-r.service.ts | 34 ++++++++++++-------------- 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'frontend/src/app/_services/signal-r.service.ts') diff --git a/frontend/src/app/_services/signal-r.service.ts b/frontend/src/app/_services/signal-r.service.ts index 5eca48d3..2a6e5d78 100644 --- a/frontend/src/app/_services/signal-r.service.ts +++ b/frontend/src/app/_services/signal-r.service.ts @@ -6,25 +6,23 @@ import { CookieService } from 'ngx-cookie-service'; providedIn: 'root' }) export class SignalRService { -private hubConnection?:signalR.HubConnection; -public startConnection=()=>{ + public hubConnection?: signalR.HubConnection; + public startConnection = () => { - this.hubConnection= new signalR.HubConnectionBuilder() - .withUrl('http://localhost:5283/chatHub', { - accessTokenFactory: () => this.cookie.get("token"), - withCredentials: false - }).build(); + this.hubConnection = new signalR.HubConnectionBuilder() + .withUrl('http://localhost:5283/chatHub', { + accessTokenFactory: () => this.cookie.get("token"), + withCredentials: false + }).build(); - this.hubConnection.on("Notify",(message:string) =>{ - console.log(" "+message); - }); + this.hubConnection.on("Notify", (message: string) => { + console.log(" " + message); + }); - - - this.hubConnection - .start() - .then(()=>console.log("con Started")) - .catch(err=>console.log("Error"+err)) -} - constructor(private cookie:CookieService) { } + this.hubConnection + .start() + .then(() => console.log("con Started")) + .catch(err => console.log("Error" + err)) + } + constructor(private cookie: CookieService) { } } -- cgit v1.2.3