firebase-element icon indicating copy to clipboard operation
firebase-element copied to clipboard

Unable to get values to update

Open ryan-pream opened this issue 10 years ago • 0 comments
trafficstars

I'm unable to get the below to work and update a firebase value. It does update locally, but it is not making it to the server. The code is able to pull firebase data in..

<dom-module id="rem-login-profile">
  <template>
    <firebase-document id="firebase" location="{{path}}" data="{{userProfile}}"></firebase-document>
  </template>
</dom-module>

<script>
  Polymer({
    is: 'rem-login-profile',
    properties: {
      rootPath: {
        type: String,
        value: 'https://------ky.firebaseio.com/users/'
      },
      uid: {
        type: String
      },
      firebaseKey: {
        type: String
      },
      userProfile: {
        type: Object,
        observer: '_userProfile'
      },
      path: {
        type: String,
        computed: 'firebaseRef(firebaseKey)'
      }
    },
    firebaseRef: function(record) {
          var path = this.rootPath + this.uid + '/' + this.firebaseKey;
          return path;
    },
    _userProfile: function() {
      if (!this.userProfile) {
        console.log('No Document');
        return;
      }
      console.log(this.userProfile);
      this.set('userProfile.loginTime', 1);
      console.log(this.userProfile);
    },
  });
</script>

ryan-pream avatar Aug 12 '15 23:08 ryan-pream