feat(helpdesk): add refresh button to ticket detail titlebar
Adds 'Refresh data' button that re-fetches the communication feed with ?refresh=1 to bypass the session cache. Shows loading skeleton during reload. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -41,16 +41,18 @@ function init(container) {
|
||||
if (el) el.hidden = false;
|
||||
}
|
||||
|
||||
async function loadCommunication() {
|
||||
async function loadCommunication(refresh = false) {
|
||||
const feedEl = document.getElementById('ticket-communication-feed');
|
||||
const loadingEl = document.getElementById('ticket-communication-loading');
|
||||
const contentEl = document.getElementById('ticket-communication-content');
|
||||
if (!feedEl || !loadingEl || !contentEl) return;
|
||||
|
||||
if (contentEl) contentEl.hidden = true;
|
||||
showLoading('ticket-communication-loading');
|
||||
|
||||
try {
|
||||
const params = new URLSearchParams({ ticketNo });
|
||||
if (refresh) params.set('refresh', '1');
|
||||
const response = await fetch(communicationUrl + '?' + params.toString(), { credentials: 'same-origin' });
|
||||
const data = await response.json();
|
||||
|
||||
@@ -85,5 +87,10 @@ function init(container) {
|
||||
}
|
||||
}
|
||||
|
||||
const refreshButton = container.querySelector('button[name="ticket-refresh"]');
|
||||
if (refreshButton) {
|
||||
refreshButton.addEventListener('click', () => loadCommunication(true));
|
||||
}
|
||||
|
||||
loadCommunication();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user