MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Creating Module with API Key/Secret

    Scheduled Pinned Locked Moved Development
    15 Posts 4 Posters 5.2k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L Offline
      lilpkstud Module Developer @lavolp3
      last edited by

      @lavolp3 I deleted this.data.name because I was getting undefined and I still am

      1 Reply Last reply Reply Quote 0
      • L Offline
        lilpkstud Module Developer
        last edited by

        @lavolp3

        This line of code will show a { on my mirror so I’m assuming everything is turned into a string?

        I used JSON.stringify() in my node_helper file

                    wrapperDataRequest.innerHTML = this.data[0];
        
        
        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @lilpkstud
          last edited by

          @lilpkstud said in Creating Module with API Key/Secret:

          JSON.stringify()

          correct… u converted the object to a string… don’t need to do that

          just pass the object from helper up to module …

          then it will use the this.data.name

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 2
          • strawberry 3.141S Offline
            strawberry 3.141 Project Sponsor Module Developer
            last edited by

            @lilpkstud next to what sdetweil said you should also not save your result into this.data as it is an instance property which already contains data, see https://github.com/MichMich/MagicMirror/tree/master/modules#available-module-instance-properties for reference

            Please create a github issue if you need help, so I can keep track

            S 1 Reply Last reply Reply Quote 2
            • S Offline
              sdetweil @strawberry 3.141
              last edited by

              @strawberry-3-141 should call it api_data maybe!

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • L Offline
                lilpkstud Module Developer
                last edited by

                @sdetwell @strawberry-3-141 thanks guys got it to work!

                I used JSON.Stringify() to look at the data when I was console.loggining so that was the reason why my object were turning into strings

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @lilpkstud
                  last edited by

                  @lilpkstud cool… if need it in strings someplace, need to convert it back object=JSON.parse(string)

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • 1
                  • 2
                  • 2 / 2
                  • First post
                    Last post
                  Enjoying MagicMirror? Please consider a donation!
                  MagicMirror created by Michael Teeuw.
                  Forum managed by Sam, technical setup by Karsten.
                  This forum is using NodeBB as its core | Contributors
                  Contact | Privacy Policy