Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 231005

postData turns Uncaught TypeError: Cannot read property 'postPvdr' of null error

$
0
0

Hi everyone i need your help about my issue. I will be happy if i can get any help of you.

I make login and in success function i need to send onesignal playerid to php again. Because i want to send notification only logged users. For this i will send playerid when user logged in and with onesignal api i will set datatag to a user. So i am using these codes to this. But when login success function i get this error when posting playerid to php.

Uncaught TypeError: Cannot read property ‘postPvdr’ of null

ps: first postData is working well and success function is working well too. But when i try to post another data in success function i get this error.

Thanks for your help.

let body = {
        login_username: this.login_username,
        login_password: this.login_password,
        login_device: this.userdevicename,
        login_device_model: this.userdevicemodel,
        login_device_marka: this.userdevicemanufacturer,
        logdatas: 'do_login'
      };

      this.postPvdr.postData(body, 'http://www.website.com/login.php').subscribe((data) =>{
        var alertbox = data.msg;
        if (data.success) {

        var notificationOpenedCallback = function(jsonData) {
          console.log('notificationOpenedCallback:' + JSON.stringify(jsonData));
        };
        window["plugins"].OneSignal
          .startInit("xxx", "xxx")
          .handleNotificationOpened(notificationOpenedCallback)
          .endInit();

        window["plugins"].OneSignal.getIds(function(ids) {
            console.log(ids.userId);
            let body = {
              loggedplayerid : ids.userId
            };
            this.postPvdr.postData(body, 'http://www.website.com/edit_device.php').subscribe(data => {
              for(let loggedplayer of data.result){
                this.loggedplayers.push(loggedplayer);
              }
            });
        });

Viewing all articles
Browse latest Browse all 231005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>