SsrPurgeItemProvider adds the item behind Clear cache for real pages (doktype < 199) whenever the purge endpoint is configured. The callback module posts the page uid to the new vitec_ssr_purge_page ajax route, which resolves the page path through the site router, purges it via SsrPurgeService (trigger contextmenu:username, logged as usual) and reports back as a toast notification. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
28 lines
982 B
JavaScript
28 lines
982 B
JavaScript
/**
|
|
* 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();
|