fix(05-review): WR-05 re-confirm push subscription server-side on health-check mount
This commit is contained in:
@@ -155,6 +155,14 @@ export function usePushSubscription(): UsePushSubscriptionReturn {
|
||||
const existingSub = await registration.pushManager.getSubscription()
|
||||
|
||||
if (existingSub) {
|
||||
// Re-confirm server-side record (handles 410-prune recovery — D-10).
|
||||
// The upsert on endpoint is idempotent; this is a no-op if the record exists.
|
||||
await fetch('/api/push/subscription', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
credentials: 'include',
|
||||
body: JSON.stringify(existingSub.toJSON()),
|
||||
}).catch(() => {}) // non-blocking — ignore network failures
|
||||
setIsSubscribed(true)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user