ranjith-dev #164
@@ -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,11 +57,11 @@
|
|||||||
applicationServerKey: vapidKey
|
applicationServerKey: vapidKey
|
||||||
});
|
});
|
||||||
|
|
||||||
await fetch('/api/push/subscribe', {
|
await fetch('/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)
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user