Skip to content
This repository was archived by the owner on Oct 5, 2020. It is now read-only.

Commit 7bb5c53

Browse files
Simplify consumer of getAuthenticatedService
Does not need to check if it returns promise or not, since always should
1 parent 6e9a9eb commit 7bb5c53

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

app/templates/ui/app/login/login.service.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -175,21 +175,12 @@
175175
}
176176

177177
if (routeIsProtected(next.name)) {
178-
var auth = service.getAuthenticatedStatus();
179-
180-
if (angular.isFunction(auth.then)) {
181-
auth.then(function() {
182-
if (!service.isAuthenticated()) {
183-
//this does NOT block requests in a timely fashion...
184-
blockRoute(event, next, nextParams);
185-
}
186-
});
187-
}
188-
else {
189-
if (!auth) {
178+
service.getAuthenticatedStatus().then(function() {
179+
if (!service.isAuthenticated()) {
180+
//this does NOT block requests in a timely fashion...
190181
blockRoute(event, next, nextParams);
191182
}
192-
}
183+
});
193184

194185
}
195186
});

0 commit comments

Comments
 (0)