/** * Context menu action "Purge from SSR cache" (SsrPurgeItemProvider). * Posts the page uid to the vitec_ssr_purge_page ajax route and shows * the outcome as a backend notification. */ import AjaxRequest from '@typo3/core/ajax/ajax-request.js'; import Notification from '@typo3/backend/notification.js'; class SsrContextMenuActions { ssrPurge(table, uid) { new AjaxRequest(TYPO3.settings.ajaxUrls.vitec_ssr_purge_page) .post({ pageUid: uid }) .then(async (response) => { const data = await response.resolve(); if (data.success) { Notification.success('SSR cache purged', data.path + ' (' + data.message + ')', 5); } else { Notification.error('SSR purge failed', data.message || 'Unknown error', 8); } }) .catch(() => { Notification.error('SSR purge failed', 'Request error - see purge protocol in the VITEC SSR module', 8); }); } } export default new SsrContextMenuActions();