From 65d955bcc68b1921f1d1669bf0b2b719c8443dee Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 5 Apr 2020 19:19:44 +1000 Subject: [PATCH] Use the new API notation for external URL ('link') --- lib/inventree/model.dart | 3 ++- lib/widget/part_display.dart | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/inventree/model.dart b/lib/inventree/model.dart index 509b92cc..40ef716a 100644 --- a/lib/inventree/model.dart +++ b/lib/inventree/model.dart @@ -45,7 +45,8 @@ class InvenTreeModel { int get parentId => jsondata['parent'] ?? -1; - String get link => jsondata['URL'] ?? ''; + // Legacy API provided external link as "URL", while newer API uses "link" + String get link => jsondata['link'] ?? jsondata['URL'] ?? ''; // Create a new object from JSON data (not a constructor!) InvenTreeModel createFromJson(Map json) { diff --git a/lib/widget/part_display.dart b/lib/widget/part_display.dart index 0588a29e..712069e6 100644 --- a/lib/widget/part_display.dart +++ b/lib/widget/part_display.dart @@ -104,7 +104,7 @@ class _PartDisplayState extends State { tiles.add( Card( child: ListTile( - title: Text("In Stock"), + title: Text("Stock"), leading: FaIcon(FontAwesomeIcons.boxes), trailing: Text("${part.inStock}"), onTap: null,