update views + reduced providers in main app
[outofuni/tavern2.git] / lib / product_service.dart
index 41af5cb..218b169 100644 (file)
@@ -57,19 +57,20 @@ class ProductService {
                }
        }
 
-       Future<Null> createProduct(String name,double price,String cat) async {
+       Future<String> createProduct(String name,double pri,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({
                                        'name': name,
-                                       'price': price,
+                                       'price': pri,
                                        'type': 'product',
                                        'category': cat
                                })
                        );
+                       return(JSON.decode(response.body)['id']);
                }
                catch(e) {
                        throw _handleError(e);