Update 02_build_a_dashboard.rst

fix rpc service use from useService to import
This commit is contained in:
Hugo Trentesaux 2025-02-13 15:19:12 +01:00 committed by GitHub
parent 4b6e34efc5
commit b46e547a93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -205,10 +205,11 @@ A basic request could look like this:
.. code-block:: js
import { rpc } from "@web/core/network/rpc";
setup() {
this.rpc = useService("rpc");
onWillStart(async () => {
const result = await this.rpc("/my/controller", {a: 1, b: 2});
const result = await rpc("/my/controller", {a: 1, b: 2});
// ...
});
}