Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49260

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);
              }
            });
        });

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 49260

Trending Articles