Remove unused CSRF token in push notification registration script
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled

This commit is contained in:
dhanabalan
2026-01-31 17:59:00 +05:30
parent 17d54cc52e
commit 93d55765ae

View File

@@ -42,7 +42,7 @@
<script> <script>
const vapidKey = "{{ config('webpush.vapid.public_key') }}"; const vapidKey = "{{ config('webpush.vapid.public_key') }}";
const csrfToken = "{{ csrf_token() }}"; // const csrfToken = "{{ csrf_token() }}";
async function registerPush() { async function registerPush() {
if (!('serviceWorker' in navigator)) return; if (!('serviceWorker' in navigator)) return;
@@ -57,15 +57,14 @@
applicationServerKey: vapidKey applicationServerKey: vapidKey
}); });
await fetch('/push/subscribe', { await fetch('api/push/subscribe', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'X-CSRF-TOKEN': csrfToken // 'X-CSRF-TOKEN': csrfToken
}, },
body: JSON.stringify(subscription) body: JSON.stringify(subscription)
}); });
alert("Push notifications enabled ✅"); alert("Push notifications enabled ✅");
} }
</script> </script>