projects
/
outofuni
/
tavern2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update views + reduced providers in main app
[outofuni/tavern2.git]
/
lib
/
product_service.dart
diff --git
a/lib/product_service.dart
b/lib/product_service.dart
index
41af5cb
..
218b169
100644
(file)
--- a/
lib/product_service.dart
+++ b/
lib/product_service.dart
@@
-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;
try {
var url=_server+'/'+_db;
- await _http.post(
+
var response =
await _http.post(
url,
headers: {'Content-Type': 'application/json'},
body: JSON.encode({
'name': name,
url,
headers: {'Content-Type': 'application/json'},
body: JSON.encode({
'name': name,
- 'price': pri
ce
,
+ 'price': pri,
'type': 'product',
'category': cat
})
);
'type': 'product',
'category': cat
})
);
+ return(JSON.decode(response.body)['id']);
}
catch(e) {
throw _handleError(e);
}
catch(e) {
throw _handleError(e);