shadowwalker / next-pwa

Zero config PWA plugin for Next.js, with workbox 🧰
MIT License
3.71k stars 312 forks source link

push notification error in nextjs #496

Closed fbryo21 closed 8 months ago

fbryo21 commented 8 months ago

I install a next-pwa example about using push notification, after I click action button, it shows error.

How I solve this, it must be not error since it's public repo in github:

**ERROR: Screenshot 2023-10-23 082123

**CODE:

const base64ToUint8Array = base64 => {
  const padding = '='.repeat((4 - (base64.length % 4)) % 4)
  const b64 = (base64 + padding).replace(/-/g, '+').replace(/_/g, '/')

  const rawData = window.atob(b64)
  const outputArray = new Uint8Array(rawData.length)

  for (let i = 0; i < rawData.length; ++i) {
    outputArray[i] = rawData.charCodeAt(i)
  }
  return outputArray
}