chore: update frontend configuration

This commit is contained in:
Matthieu
2025-09-26 11:29:47 +02:00
parent b7caa4f552
commit a78938a4d1
64 changed files with 5790 additions and 5129 deletions

View File

@@ -1,6 +1,6 @@
import { useToast } from './useToast'
export function useApi() {
export function useApi () {
const { showSuccess, showError, showInfo } = useToast()
const { public: publicConfig } = useRuntimeConfig()
const API_BASE_URL = publicConfig.apiBaseUrl || 'http://localhost:3000'
@@ -11,8 +11,8 @@ export function useApi() {
const url = `${API_BASE_URL}${endpoint}`
const defaultOptions = {
headers: {
'Content-Type': 'application/json',
},
'Content-Type': 'application/json'
}
}
// Ajouter un timeout à la requête
@@ -20,14 +20,14 @@ export function useApi() {
const timeoutId = setTimeout(() => controller.abort(), API_TIMEOUT)
try {
const response = await fetch(url, {
...defaultOptions,
const response = await fetch(url, {
...defaultOptions,
...options,
signal: controller.signal
})
clearTimeout(timeoutId)
if (response.ok) {
const data = await response.json()
return { success: true, data }