luci-mod-status: fix determining DSL modem type
authorJo-Philipp Wich <jo@mein.io>
Sat, 22 Oct 2022 13:46:47 +0000 (15:46 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sat, 22 Oct 2022 13:46:47 +0000 (15:46 +0200)
The `network.getDSLModemType()` function returns a promise, so handle it
accordingly.

Fixes: 45ab2cd6be ("luci-mod-status: use network.getDSLModemType()")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js

index b6f24b1aabebfbd548bc8afab1b6950d811011da..0ee0b9033a91da0764cd4163dbd160a7c688d188 100644 (file)
@@ -45,10 +45,12 @@ return baseclass.extend({
        title: _('DSL'),
 
        load: function() {
-               if (!network.getDSLModemType())
-                       return Promise.reject();
+               return network.getDSLModemType().then(function(type) {
+                       if (!type)
+                               return Promise.reject();
 
-               return L.resolveDefault(callDSLMetrics(), {});
+                       return L.resolveDefault(callDSLMetrics(), {});
+               });
        },
 
        render: function(dsl) {