Giter VIP home page Giter VIP logo

Comments (5)

Philip2809 avatar Philip2809 commented on May 21, 2024

you can ask for the dashboard info directly, either via the service in self.ctx.dashboardService.getDashboardInfo() it calls /api/dashboard/info/${dashboardId}, check dashboard.service.ts for more. This automatically authenticates with logged in user.

Otherwise you can use localStorage.jwt_token.

from thingsboard.

sushil2817 avatar sushil2817 commented on May 21, 2024

you can ask for the dashboard info directly, either via the service in self.ctx.dashboardService.getDashboardInfo() it calls /api/dashboard/info/${dashboardId}, check dashboard.service.ts for more. This automatically authenticates with logged in user.

Otherwise you can use localStorage.jwt_token.

Could you please elaborate this?

from thingsboard.

Philip2809 avatar Philip2809 commented on May 21, 2024

in your widget code:
self.ctx.dashboardService.getDashboardInfo(location.pathname.split('/')[2]).subscribe(d => console.log(d.createdTime))

This gets the current dashboardid based on the url and console logs the createdTime

from thingsboard.

sushil2817 avatar sushil2817 commented on May 21, 2024

self.ctx.dashboardService.getDashboardInfo(location.pathname.split('/')[2]).subscribe(d => console.log(d.createdTime))

This snippet of code is giving an error: "Cannot read properties of undefined (reading 'dashboardService')" how can I deal with this kind of code?... I think the problem is in subscribe method

from thingsboard.

sushil2817 avatar sushil2817 commented on May 21, 2024

I Solved this problem using localStorage token, then fetched the API and got my results.

from thingsboard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.