Skip to content

Commit 565c0b8

Browse files
Fixed type body value placement.
1 parent 774d573 commit 565c0b8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/jobs/SubscribeButton.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ const SubscribeButton: React.FC = () => {
99
applicationServerKey: process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY,
1010
})
1111

12+
// Convert PushSubscription to plain object
13+
const subData = {
14+
...JSON.parse(JSON.stringify(subscription)),
15+
type: 'web', // Add type explicitly
16+
}
17+
1218
await fetch('/api/subscribe', {
1319
method: 'POST',
1420
headers: { 'Content-Type': 'application/json' },
15-
body: JSON.stringify({ ...subscription, type: 'web' }),
21+
body: JSON.stringify(subData),
1622
})
1723
alert('Subscribed to notifications')
1824
} catch (error) {

0 commit comments

Comments
 (0)