X-Git-Url: https://hackdaworld.org/gitweb/?p=outofuni%2Ftavern2.git;a=blobdiff_plain;f=lib%2Fproduct_category_service.dart;fp=lib%2Fproduct_category_service.dart;h=0d2830dfc33dddd615c454b9a678c4c74c532c2c;hp=f246a71183bb69148c668305e146d9b89c94cc8a;hb=74001e08303ce797811fc91816a67c2006fe0a25;hpb=b2028ca4879e48884436ee0c2aee7fae6ddaeb5a diff --git a/lib/product_category_service.dart b/lib/product_category_service.dart index f246a71..0d2830d 100644 --- a/lib/product_category_service.dart +++ b/lib/product_category_service.dart @@ -35,9 +35,9 @@ class ProductCategoryService { } } - Future createProdCategory(String name) async { + Future createProdCategory(String name) async { try { - await _http.post( + var res = await _http.post( _posturl, headers: {'Content-Type': 'application/json'}, body: JSON.encode({ @@ -45,6 +45,7 @@ class ProductCategoryService { 'type': 'product_category' }) ); + return(JSON.decode(res.body)['id']); } catch(e) { throw _handleError(e);