cleaups and content page refresh (in progress)
[outofuni/tavern2.git] / lib / product_service.dart
index 41af5cb..0ffe964 100644 (file)
@@ -60,7 +60,7 @@ class ProductService {
        Future<Null> createProduct(String name,double price,String cat) async {
                try {
                        var url=_server+'/'+_db;
-                       await _http.post(
+                       var response = await _http.post(
                                url,
                                headers: {'Content-Type': 'application/json'},
                                body: JSON.encode({
@@ -70,6 +70,7 @@ class ProductService {
                                        'category': cat
                                })
                        );
+                       return(JSON.decode(response.body)['id']);
                }
                catch(e) {
                        throw _handleError(e);