Manage the subscription state using localStorage, IndexedDB, or a server-side solution(e.g. in Firestore, store per-user), depending on the flow of your app.
Create a notification section in settings, in navbar or just prompt it directly(not recommended, bad UX).
On UI interaction such as a subscribe
button, call subscribeNotifications
with the related parameters(subscribe = true/false, token
), then persist the notification state.