From 7cff75e82cea28892d53376e05d0d053392b8bec Mon Sep 17 00:00:00 2001 From: Kevser <> Date: Wed, 30 Jul 2025 09:44:00 +0300 Subject: [PATCH] =?UTF-8?q?Socket=20urlsi=20env=20dosyas=C4=B1nda=20tan?= =?UTF-8?q?=C4=B1mland=C4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 +- .env.localdev | 3 +- .env.production | 3 +- .../cekilisler/service/signalrService.ts | 38 +++++++++---------- 4 files changed, 25 insertions(+), 22 deletions(-) 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) +}