fix download -dox never load version, improve templ page
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 3s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 1m20s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 4s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 1s

This commit is contained in:
oom 2026-11-03 21:40:43 +07:00
parent 3e800533d5
commit 2486b6e434
3 changed files with 243 additions and 87 deletions

View file

@ -34,8 +34,7 @@ async function processRequest(fid: string, tid: string, uid: string, uname: stri
try { //ตรวจสอบ docx เวอร์ชั่นล่าสุดก่อนถ้าไม่พบค่อยเอาจากฐานข้อมูลมาสร้าง raw Json
const params = new URLSearchParams({ type: 'docx', ticket_data });
console.log(`search ${DOCEDIT_BASE_URL}/api/document/latest?${params.toString()}`);
const lastestDocxResponse = await fetch(`${DOCEDIT_BASE_URL}/api/document/latest?${params.toString()}`, {
const lastestDocxResponse = await fetch(`${DOCEDIT_BASE_URL}/api/documents/latest?${params.toString()}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -44,7 +43,7 @@ async function processRequest(fid: string, tid: string, uid: string, uname: stri
});
// เช็ค Content-Type และ Status ก่อน
const contentType = lastestDocxResponse.headers.get('content-type') || '';
if (lastestDocxResponse.ok && !!contentType.includes('text/html')) {
if (lastestDocxResponse.ok && !contentType.includes('text/html')) {
console.log('Fund latest docx from docedit, returning stream to browser');
const stream = lastestDocxResponse.body;
//ส่ง Binary Stream กลับไปยัง Browser พร้อม Header กำหนดประเภทไฟล์