diff --git a/.env.development b/.env.development index 0a60112..e3c30f4 100644 --- a/.env.development +++ b/.env.development @@ -1 +1,2 @@ -VITE_API_URL=http://panelapi.cekilisevitest.gov.tr/ \ No newline at end of file +VITE_API_URL=http://panelapi.cekilisevitest.gov.tr/ +VITE_SOCKET_URL=https://panelapi.cekilisevitest.gov.tr/uploadHub \ No newline at end of file diff --git a/.env.localdev b/.env.localdev index eb228c4..74055aa 100644 --- a/.env.localdev +++ b/.env.localdev @@ -1 +1,2 @@ -VITE_API_URL=https://localhost:7241/ \ No newline at end of file +VITE_API_URL=https://localhost:7241/ +VITE_SOCKET_URL=https://localhost:7241/uploadHub \ No newline at end of file diff --git a/.env.production b/.env.production index f8e16bb..19b57fa 100644 --- a/.env.production +++ b/.env.production @@ -1 +1,2 @@ -VITE_API_URL=https://panelapi.cekilisevi.gov.tr/ \ No newline at end of file +VITE_API_URL=https://panelapi.cekilisevi.gov.tr/ +VITE_SOCKET_URL=https://panelapi.cekilisevi.gov.tr/uploadHub \ No newline at end of file diff --git a/src/module/cekilisler/service/signalrService.ts b/src/module/cekilisler/service/signalrService.ts index 97ac4e5..1e71439 100644 --- a/src/module/cekilisler/service/signalrService.ts +++ b/src/module/cekilisler/service/signalrService.ts @@ -1,34 +1,34 @@ -import * as signalR from "@microsoft/signalr"; -import { v4 as uuidv4 } from "uuid"; +import * as signalR from '@microsoft/signalr' +import { v4 as uuidv4 } from 'uuid' -let connection: signalR.HubConnection; -let connectionId = ""; +let connection: signalR.HubConnection +let connectionId = '' export const connectToHub = async () => { connection = new signalR.HubConnectionBuilder() - .withUrl("https://panelapi.cekilisevi.gov.tr/uploadHub", { - withCredentials: false // Bu zorunlu, yoksa cookie vs gönderilmez + .withUrl(import.meta.env.VITE_SOCKET_URL, { + withCredentials: false // Bu zorunlu, yoksa cookie vs gönderilmez }) // backend adresine göre düzenle .withAutomaticReconnect() - .build(); + .build() - await connection.start(); - connectionId = connection.connectionId || uuidv4(); // SignalR id'si ya da frontend'de de guid üretilebilir - return connectionId; -}; + await connection.start() + connectionId = connection.connectionId || uuidv4() // SignalR id'si ya da frontend'de de guid üretilebilir + return connectionId +} export const onProgress = (callback: (data: any) => void) => { - connection.on("ReceiveProgress", callback); -}; + connection.on('ReceiveProgress', callback) +} export const onInsertProgress = (callback: (data: any) => void) => { - connection.on("ReceiveInsertProgress", callback); -}; + connection.on('ReceiveInsertProgress', callback) +} export const onCompleted = (callback: (data: any) => void) => { - connection.on("ReceiveCompleted", callback); -}; + connection.on('ReceiveCompleted', callback) +} export const onError = (callback: (data: any) => void) => { - connection.on("ReceiveError", callback); -}; \ No newline at end of file + connection.on('ReceiveError', callback) +}