Invoices can be uploaded

This commit is contained in:
2026-02-11 15:40:06 +01:00
parent bccfc11687
commit ee7fc637f1
47 changed files with 1751 additions and 67 deletions

View File

@@ -8,6 +8,8 @@ export function useAjax() {
async function request(url, options = {}) {
loading.value = true
const isFormData = options.body instanceof FormData
error.value = null
data.value = null
@@ -15,14 +17,19 @@ export function useAjax() {
const response = await fetch(url, {
method: options.method || "GET",
headers: {
"Content-Type": "application/json",
'X-CSRF-TOKEN': csrfToken,
...(isFormData ? {} : { 'Content-Type': 'application/json' }),
...(options.headers || {}),
},
body: options.body ? JSON.stringify(options.body) : null,
body: isFormData
? options.body // ✅ FormData direkt
: options.body
? JSON.stringify(options.body)
: null,
})
if (!response.ok) throw new Error(`HTTP ${response.status}`)
const result = await response.json()
data.value = result
return result
@@ -35,6 +42,7 @@ export function useAjax() {
}
}
async function download(url, options = {}) {
loading.value = true
error.value = null