Fix?
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 42s

This commit is contained in:
2026-06-12 00:12:30 +02:00
parent 142d655d84
commit 9b7751c571
4 changed files with 16 additions and 6 deletions

View File

@@ -1,9 +1,13 @@
// composables/useApi.js
import { ref } from 'vue'
function normalizeUrl(url: string): string {
return url.replace(/\/+$/, '')
}
export default function useApi() {
const config = useRuntimeConfig()
const baseUrl = config.public.apiBaseUrl
const baseUrl = `${normalizeUrl(config.public.apiBaseUrl)}/api`
// Generic GET request
const get = async (endpoint) => {

View File

@@ -1,9 +1,13 @@
import { ref, onUnmounted } from 'vue'
import { io } from 'socket.io-client'
function normalizeUrl(url: string): string {
return url.replace(/\/+$/, '')
}
export default function useSocket() {
const config = useRuntimeConfig()
const socketUrl = `${config.public.apiBaseUrl.replace('/api', '')}`
const apiBaseUrl = normalizeUrl(config.public.apiBaseUrl)
const socket = ref(null)
const isConnected = ref(false)
@@ -11,7 +15,8 @@ export default function useSocket() {
function initSocket() {
if (socket.value) return
const s = io(socketUrl, {
const s = io(apiBaseUrl, {
path: '/api/socket.io',
transports: ['websocket', 'polling'],
reconnection: true,
reconnectionAttempts: 10,