Problem
The error ReferenceError: getCookie is not defined occurs because the code attempts to call a function named getCookie to retrieve a CSRF token, but that function is not the <script> section of the HTML file.
Solution
Since the csrftoken is not being used in the fetch call anyway, we can simply delete the line causing the error