Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit d8489b9

Browse files
authored
Merge pull request #997 from appirio-tech/tom-listings-auth
Tom listings auth
2 parents 03bcd01 + 3faefdd commit d8489b9

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

Diff for: app/listings/listings.controller.js

100644100755
+17-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
import angular from 'angular'
2+
import { loadUser } from '../services/userv3.service.js'
23

34
(function () {
45
'use strict'
56

67
angular.module('tc.listings').controller('ListingsCtrl', ListingsCtrl)
78

8-
ListingsCtrl.$inject = ['CONSTANTS', 'logger', '$q',
9-
'TcAuthService', 'UserService', 'UserStatsService', 'ProfileService', 'ChallengeService', 'ExternalAccountService',
10-
'ngDialog', '$anchorScroll'
9+
ListingsCtrl.$inject = ['CONSTANTS', 'logger', '$q','TcAuthService', 'UserService',
10+
'UserStatsService', 'ProfileService', 'ChallengeService',
11+
'ExternalAccountService', 'ngDialog', '$anchorScroll', '$scope'
1112
]
1213

13-
function ListingsCtrl(CONSTANTS, logger, $q, TcAuthService, UserService, UserStatsService, ProfileService, ChallengeService, ExternalAccountService, ngDialog, $anchorScroll) {
14+
function ListingsCtrl(CONSTANTS, logger, $q, TcAuthService, UserService, UserStatsService, ProfileService,
15+
ChallengeService, ExternalAccountService, ngDialog, $anchorScroll, $scope) {
1416

1517
activate()
1618

1719
function activate() {
20+
$scope.myChallenges = []
21+
$scope.userProps = { isAuth: false }
1822
logger.debug('Calling ListingsController activate()')
1923

24+
loadUser().then(function(token) {
25+
// update auth flag
26+
if(TcAuthService.isAuthenticated()) {
27+
$scope.userProps = { isAuth: true }
28+
}
29+
}, function(error) {
30+
// do nothing, just show non logged in state of navigation bar
31+
})
2032
}
33+
2134
}
2235

2336
})()

Diff for: app/listings/listings.jade

100644100755
+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
react-component(name="ChallengeFiltersExample")
1+
2+
<react-component name="ChallengeFiltersExample" props="userProps" watch-depth="reference"/>

Diff for: app/listings/listings.module.js

100644100755
File mode changed.

Diff for: app/listings/listings.routes.js

100644100755
File mode changed.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"appirio-styles": "0.x.x",
5757
"appirio-tech-ng-iso-constants": "^1.0.6",
5858
"appirio-tech-ng-ui-components": "^2.1.2",
59-
"appirio-tech-react-components": "appirio-tech/react-components.git#challenge-listings",
59+
"appirio-tech-react-components": "nomo-kazza/react-components.git#challenge-listings",
6060
"auth0-angular": "^4.1.0",
6161
"auth0-js": "^6.8.0",
6262
"d3": "^3.5.14",

0 commit comments

Comments
 (0)