File tree Expand file tree Collapse file tree 4 files changed +25
-7
lines changed
awesome_dashboard/static/src Expand file tree Collapse file tree 4 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -3,20 +3,20 @@ import {registry} from "@web/core/registry";
33import { Layout } from "@web/search/layout" ;
44import { useService } from "@web/core/utils/hooks"
55import { _t } from "@web/core/l10n/translation" ;
6- import { DashboardItem } from "./dashboard_item" ;
7- import { rpc } from "@web/core/network/rpc" ;
6+ import { DashboardItem } from "./dashboard_item/dashboard_item" ;
87
98class AwesomeDashboard extends Component {
109 static template = "awesome_dashboard.AwesomeDashboard" ;
1110 static components = { Layout, DashboardItem } ;
1211
1312 setup ( ) {
1413 this . action = useService ( "action" ) ;
15- onWillStart ( async ( ) => {
16- const result = await rpc ( "/awesome_dashboard/statistics" , { } ) ;
17- this . statistics = result
18- console . log ( this . statistics ) ;
19- } )
14+ this . statsService = useService ( "awesome_dashboard.statistics" ) ;
15+
16+ onWillStart ( async ( ) => {
17+ this . statistics = await this . statsService . loadStatistics ( ) ;
18+ } ) ;
19+ console . log ( this . statistics ) ;
2020 }
2121
2222 openCustomers ( ) {
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 1+ import { registry } from "@web/core/registry" ;
2+ import { rpc } from "@web/core/network/rpc" ;
3+ import { memoize } from "@web/core/utils/functions" ;
4+ // import { reactive } from "@odoo/owl";
5+
6+ const statisticsService = {
7+
8+ start ( ) {
9+
10+ const loadStatistics = memoize ( async ( ) => {
11+ return await rpc ( "/awesome_dashboard/statistics" , { } ) ;
12+ } ) ;
13+
14+ return { loadStatistics } ;
15+ }
16+ }
17+
18+ registry . category ( "services" ) . add ( "awesome_dashboard.statistics" , statisticsService ) ;
You can’t perform that action at this time.
0 commit comments