cleaups and content page refresh (in progress)
[outofuni/tavern2.git] / lib / product_category_component.dart
index 6963399..b7d3bf1 100644 (file)
@@ -22,26 +22,19 @@ import 'package:angular2_rbi/directives.dart';
 class ProductCategoryComponent implements OnInit {
        List<ProductCategory> product_categories;
        ProductCategory selected_prod_category;
-       String new_prod_category_name;
-       String new_prod_category_id;
+       String new_prod_category_name='';
        final ProductCategoryService _prodcatSrv;
        final Router _router;
 
        ProductCategoryComponent(this._prodcatSrv,this._router);
 
-       Future<Null> getProductCategories() async {
-               product_categories = await _prodcatSrv.getAll();
-       }
-
        Future<Null> createProductCategory() async {
-               await _prodcatSrv.createProdCategory(
-                       new_prod_category_name,
-                       new_prod_category_id
-               );
+               await _prodcatSrv.createProdCategory(new_prod_category_name);
+               await ngOnInit();
        }
 
-       void ngOnInit() {
-               getProductCategories();
+       Future<Null> ngOnInit() async {
+               product_categories = await _prodcatSrv.getAll();
        }
 
        choose(ProductCategory pt) {