We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 774d573 commit 565c0b8Copy full SHA for 565c0b8
src/components/jobs/SubscribeButton.tsx
@@ -9,10 +9,16 @@ const SubscribeButton: React.FC = () => {
9
applicationServerKey: process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY,
10
})
11
12
+ // Convert PushSubscription to plain object
13
+ const subData = {
14
+ ...JSON.parse(JSON.stringify(subscription)),
15
+ type: 'web', // Add type explicitly
16
+ }
17
+
18
await fetch('/api/subscribe', {
19
method: 'POST',
20
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ ...subscription, type: 'web' }),
21
+ body: JSON.stringify(subData),
22
23
alert('Subscribed to notifications')
24
} catch (error) {
0 commit comments