-2

I want to send push notifications to thousands of mobile users. Do i need to store the registration tokens of all the users in my database ? If so how can i store it efficiently while detecting the token changes and all ? I want to send push notifications for all the users whether they are logged in or not.

I am extracting token like this

 await getToken(messaging, {
      vapidKey: 'vapid key',
    })
      .then((currentToken: any) => {
        if (currentToken) {
          console.log('toekn', currentToken)
          // Send the token to your server and update the UI if necessary
        } else {
          // Show permission request UI
          console.log(
            'No registration token available. Request permission to generate one.',
          )
        }
      })
      .catch(err => {
        console.log('An error occurred while retrieving token. ', err)
      })
Sudip Shrestha
  • 321
  • 1
  • 9

1 Answers1

1

It looks like a react part and the rendere part does not contain an object for filtering.

Anyway it is a good idea to do the filtering first and then render the data set for output.

const
    weekLogs = this.props.weeklyLogs          
        .filter(weekLogs => weekLogs.id<10)  
        .map(weekLogs =>
            <div >
                <h3>{weekLogs.title}</h3>
            </div>
        )
Nina Scholz
  • 376,160
  • 25
  • 347
  • 392