From de4fdc2c72e7105d58b32b809117f183ae3b77a3 Mon Sep 17 00:00:00 2001 From: F4ilji Date: Thu, 2 Jul 2026 01:29:05 +0500 Subject: [PATCH] fix: add credentials same-origin to Deploy fetch calls Without this, session cookie is not sent with fetch() requests, causing server to redirect to login (returning HTML instead of JSON). --- resources/js/Pages/Dashboard/Deploy/Index.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/js/Pages/Dashboard/Deploy/Index.vue b/resources/js/Pages/Dashboard/Deploy/Index.vue index 1d27660..bdee50a 100644 --- a/resources/js/Pages/Dashboard/Deploy/Index.vue +++ b/resources/js/Pages/Dashboard/Deploy/Index.vue @@ -50,6 +50,7 @@ async function startDeploy() { try { const response = await fetch(route('dashboard.deploy'), { method: 'POST', + credentials: 'same-origin', headers: { 'Content-Type': 'application/json', 'X-XSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.getAttribute('content') || '', @@ -79,12 +80,14 @@ function startPolling() { pollInterval = setInterval(async () => { try { const statusRes = await fetch(route('dashboard.deploy.status'), { + credentials: 'same-origin', headers: { 'Accept': 'application/json' }, }) const statusData = await statusRes.json() deployStatus.value = statusData const logRes = await fetch(route('dashboard.deploy.log') + '?lines=100', { + credentials: 'same-origin', headers: { 'Accept': 'application/json' }, }) const logData = await logRes.json() @@ -113,6 +116,7 @@ async function clearLog() { try { await fetch(route('dashboard.deploy.clear'), { method: 'POST', + credentials: 'same-origin', headers: { 'X-XSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.getAttribute('content') || '', 'Accept': 'application/json',