From 8f47e3d7ae4765a4b6271f95f53728de4e013c0a Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 6 Mar 2018 16:20:31 +0100 Subject: [PATCH] [webpack.teacher.view] added fetching categories for 'create' card --- config/modules.json | 4 ++-- webpack/component/teacher/view.vue | 12 +++--------- webpack/data/teacher.js | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/config/modules.json b/config/modules.json index 3d6a035..f6b6e74 100644 --- a/config/modules.json +++ b/config/modules.json @@ -216,10 +216,10 @@ "category": { "GET": { - "des" : "Get all data about a professor category", + "des" : "Get all data about a given category | all", "per": [], "par": { - "URL0":{"des" : "Id of the category", "typ": "id", "ren": "idCat", "opt" : true} + "URL0": { "des": "Id of the category", "typ": "id", "ren": "cat_id", "opt": true } } } } diff --git a/webpack/component/teacher/view.vue b/webpack/component/teacher/view.vue index f4976cd..11c7916 100644 --- a/webpack/component/teacher/view.vue +++ b/webpack/component/teacher/view.vue @@ -6,17 +6,11 @@
-
+

diff --git a/webpack/data/teacher.js b/webpack/data/teacher.js index a20c332..ab499ee 100644 --- a/webpack/data/teacher.js +++ b/webpack/data/teacher.js @@ -17,6 +17,26 @@ api.call('GET professor/1/', { vh: true }, function(rs){ + +/* (2) Load categories (for creating a professor) +---------------------------------------------------------*/ +/* (1) Initialize list */ +gstore.add('categories', []); + +/* (2) Get categories */ +api.call('GET category', { vh: true }, function(rs){ + + // {1} If error -> abort // + if( rs.error !== 0 )return console.log('No categorie found, error: '+rs.error); + console.log(rs); + + // {2} Store categories // + gstore.get.categories = rs.categories; + +}); + + + /* (2) Define filters' callback ---------------------------------------------------------*/ /* (1) Define global callback */