Merge remote-tracking branch 'origin/master'

This commit is contained in:
2026-02-16 16:07:49 +03:00
parent 14d71ba925
commit 54182e97c5
3 changed files with 18 additions and 18 deletions

View File

@@ -1,10 +1,10 @@
// src/stores/downloadstHeadStore.js
// src/stores/downloadstHeadStore.js
import { defineStore } from 'pinia'
import { download, extractApiErrorDetail } from 'src/services/api'
export const useDownloadstHeadStore = defineStore('downloadstHead', {
actions: {
// 📄 Statement Header PDF indir / aç
// 📄 Statement Header PDF indir / aç
async handlestHeadDownload (
accountCode,
startDate,
@@ -12,7 +12,7 @@ export const useDownloadstHeadStore = defineStore('downloadstHead', {
parislemler
) {
try {
// ✅ Params (axios paramsSerializer array=repeat destekliyor)
// Params (axios paramsSerializer array=repeat destekliyor)
const params = {
accountcode: accountCode,
startdate: startDate,
@@ -25,7 +25,7 @@ export const useDownloadstHeadStore = defineStore('downloadstHead', {
)
}
// 🔥 API CALL (TOKEN + BLOB + ERROR HANDLING OTOMATİK)
// 🔥 API CALL (TOKEN + BLOB + ERROR HANDLING OTOMATİK)
const blob = await download(
'/exportstamentheaderreport-pdf',
params
@@ -34,17 +34,17 @@ export const useDownloadstHeadStore = defineStore('downloadstHead', {
const pdfUrl = window.URL.createObjectURL(blob)
window.open(pdfUrl, '_blank')
return { ok: true, message: '📄 PDF hazırlandı' }
return { ok: true, message: '📄 PDF hazırlandı' }
} catch (err) {
const detail = await extractApiErrorDetail(err)
const status = err?.status || err?.response?.status || '-'
console.error(` PDF açma hatası [${status}] /exportstamentheaderreport-pdf: ${detail}`)
console.error(`? PDF a<EFBFBD>ma hatas<EFBFBD> [${status}] /exportstamentheaderreport-pdf: ${detail}`)
return {
ok: false,
message:
detail ||
'PDF açma hatası'
'PDF a<EFBFBD>ma hatas<EFBFBD>'
}
}
}

View File

@@ -1,15 +1,15 @@
// src/stores/downloadstpdfStore.js
// src/stores/downloadstpdfStore.js
import { defineStore } from 'pinia'
import { download, extractApiErrorDetail } from 'src/services/api'
export const useDownloadstpdfStore = defineStore('downloadstpdf', {
actions: {
/* ==========================================================
📄 PDF İNDİR / AÇ
📄 PDF İNDİR / AÇ
========================================================== */
async downloadPDF(accountCode, startDate, endDate, parislemler = []) {
try {
// 🔹 Query params
// 🔹 Query params
const params = {
accountcode: accountCode,
startdate: startDate,
@@ -22,30 +22,30 @@ export const useDownloadstpdfStore = defineStore('downloadstpdf', {
)
}
// 🔥 MERKEZİ API — BLOB
// 🔥 MERKEZİ API BLOB
const blob = await download('/export-pdf', params)
// 🔹 Blob → URL
// 🔹 Blob URL
const pdfUrl = window.URL.createObjectURL(
new Blob([blob], { type: 'application/pdf' })
)
// 🔹 Yeni sekmede aç
// 🔹 Yeni sekmede aç
window.open(pdfUrl, '_blank')
console.log('✅ PDF yeni sekmede açıldı')
return { ok: true, message: '📄 PDF hazırlandı' }
console.log(' PDF yeni sekmede açıldı')
return { ok: true, message: '📄 PDF hazırlandı' }
} catch (err) {
const detail = await extractApiErrorDetail(err)
const status = err?.status || err?.response?.status || '-'
console.error(` PDF açma hatası [${status}] /export-pdf: ${detail}`)
console.error(`? PDF a<EFBFBD>ma hatas<EFBFBD> [${status}] /export-pdf: ${detail}`)
return {
ok: false,
message:
detail ||
'PDF alınamadı'
'PDF al<EFBFBD>namad<EFBFBD>'
}
}
}