Skip to content

Commit

Permalink
Inject CSRF token in line with new DRF template
Browse files Browse the repository at this point in the history
  • Loading branch information
Yrob committed Jul 30, 2024
1 parent f6e9617 commit 1223de2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/templates/dso_api/dynamic_api/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,11 @@ <h5>Bronhouder: {{ authorization_grantor|default_if_none:"Onbekend"}}</h5>
<option value="false">false</option>
</datalist>
</div>
<script>
window.drf = {
csrfHeaderName: "{{ csrf_header_name|default:'X-CSRFToken' }}",
csrfToken: "{% if request %}{{ csrf_token }}{% endif %}"
};
<script type="application/json" id="drf_csrf">
{
"csrfHeaderName": "{{ csrf_header_name|default:'X-CSRFToken' }}",
"csrfToken": "{% if request %}{{ csrf_token }}{% endif %}"
}
</script>
<script>
const DATASET_URL = "{{ dataset_url }}";
Expand Down

0 comments on commit 1223de2

Please sign in to comment.