[SDPAP-8087] Use GET to allow AJAX request #432
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Jira
https://digital-vic.atlassian.net/browse/SDPAP-8087
Problem/Motivation
The site_alert js is making a POST request to the {{ajax/site_alert}}resource every 5 seconds.
This leads to a significant number of requests being made to the CMS that cannot be cached.
Fix
Use HTTP GET to allow caching of AJAX request
Related PRs
https://www.drupal.org/project/site_alert/issues/3160200#comment-15217710
Screenshots
The router responsible for handling
ajax/site_alert
requests has already cached the response.https://git.drupalcode.org/issue/site_alert-3160200/-/blob/3160200-use-http-get/src/Controller/SiteAlertController.php#L126