Quellcode durchsuchen

users get all

tags/0.1.0
Robin Thoni vor 9 Jahren
Ursprung
Commit
5bc81b8360
1 geänderte Dateien mit 37 neuen und 16 gelöschten Zeilen
  1. 37
    16
      src/users.js

+ 37
- 16
src/users.js Datei anzeigen

@@ -8,23 +8,44 @@
8 8
         .factory('luticateAuthUsers', ['luticateRequest', '$q', 'luticateAuthCache',
9 9
             function(luticateRequest, $q, luticateAuthCache) {
10 10
 
11
-            var luticateAuthUsers = {};
11
+                var luticateAuthUsers = {};
12 12
 
13
-            luticateAuthUsers.login = function(data, promise)
14
-            {
15
-                var defer = $q.defer();
16
-                luticateRequest.post("/api/luticate/users/login", data, null, promise)
17
-                    .then(function(data)
18
-                    {
19
-                        luticateAuthCache.setUser(data);
20
-                        defer.resolve(data);
21
-                    }, function(error)
22
-                    {
23
-                        luticateAuthCache.removeUser();
24
-                        defer.reject(error);
25
-                    });
26
-                return defer.promise;
27
-            };
13
+                luticateAuthUsers.login = function(data, promise)
14
+                {
15
+                    var defer = $q.defer();
16
+                    luticateRequest.post("/api/luticate/users/login", data, null, promise)
17
+                        .then(function(data)
18
+                        {
19
+                            luticateAuthCache.setUser(data);
20
+                            defer.resolve(data);
21
+                        }, function(error)
22
+                        {
23
+                            luticateAuthCache.removeUser();
24
+                            defer.reject(error);
25
+                        });
26
+                    return defer.promise;
27
+                };
28
+
29
+                luticateAuthUsers.logout = function(promise)
30
+                {
31
+                    var defer = $q.defer();
32
+                    luticateRequest.post("/api/luticate/users/logout", null, null, promise)
33
+                        .then(function(data)
34
+                        {
35
+                            luticateAuthCache.removeUser();
36
+                            defer.resolve(null);
37
+                        }, function(error)
38
+                        {
39
+                            luticateAuthCache.removeUser();
40
+                            defer.resolve(null);
41
+                        });
42
+                    return defer.promise;
43
+                };
44
+
45
+                luticateAuthUsers.getAll = function(data, promise)
46
+                {
47
+                    return luticateRequest.get("/api/luticate/users", data, promise);
48
+                };
28 49
 
29 50
             return luticateAuthUsers;
30 51
         }]);

Laden…
Abbrechen
Speichern