Passed
Push — master ( fe1539...291954 )
by Guangyu
17:41 queued 11s
created

admin/app/services/settings/menu/menu.service.js   A

Complexity

Total Complexity 10
Complexity/F 1

Size

Lines of Code 32
Function Count 10

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 10
eloc 21
dl 0
loc 32
rs 10
c 0
b 0
f 0
mnd 0
bc 0
fnc 10
bpm 0
cpm 1
noi 0
1
'use strict';
2
app.factory('MenuService', function($http) {
3
    return {
4
        getAllMenus:function(callback){
5
            $http.get(getAPI()+'menus')
6
                .success(function (response, status, headers, config) {
7
                    callback(null, response);
8
                })
9
                .error(function (e) {
10
                    callback(e);
11
                });
12
        },
13
        getMenuChildren:function(menuid, callback){
14
            $http.get(getAPI()+'menus/'+menuid+'/children')
15
                .success(function (response, status, headers, config) {
16
                    callback(null, response);
17
                })
18
                .error(function (e) {
19
                    callback(e);
20
                });
21
        },
22
        editMenu: function(menu, callback) {
23
            $http.put(getAPI()+'menus/'+menu.id,{data:menu})
24
                .success(function (response, status, headers, config) {
25
                    callback(null, status);
26
                })
27
                .error(function (e) {
28
                    callback(e);
29
                });
30
        }
31
    };
32
});
33