Skip to content

Commit

Permalink
Added loading text on sign-in status check
Browse files Browse the repository at this point in the history
  • Loading branch information
tanykim committed May 30, 2016
1 parent 16ddc37 commit ba9ad45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client/scripts/controllers/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ angular.module('365daysApp').controller('MainCtrl', [
$scope.hasValidCookies = false;

function updateTokenStatus(status) {
$scope.hasValidToken = status;
$scope.hasValidToken = status;
$scope.checkingValidCookies = false;
}

if ($cookies.get('token')) {
$scope.checkingValidCookies = true;
cookieManager.checkTokenValidity(updateTokenStatus);
$scope.hasFirstDateCookie = $cookies.get('firstDate');
}

$scope.$watchGroup(['hasValidToken', 'hasFirstDateCookie'], function (newVal, oldVal) {
console.log(newVal, oldVal);
if (newVal[0] && newVal[1]) {
$scope.hasValidCookies = true;
}
Expand Down
2 changes: 2 additions & 0 deletions client/views/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ <h1>365 Days</h1>
Powered by <a href="https://www.moves-app.com/" target="_blank">Moves</a>
</p>

<p ng-show="checkingValidCookies"> Checking if already signed in... </p>

<p ng-show="hasValidCookies">Already signed in <a class="btn btn-success" href="/#year">Go forward<span class="glyphicon glyphicon-ok"></span></a></p>

<p><a class="btn btn-lg btn-success" ng-click="authenticateMoves()">Sign with with Moves <span class="glyphicon glyphicon-ok"></span></a></p>
Expand Down

0 comments on commit ba9ad45

Please sign in to comment.