Skip to content

Commit d8489b9

Browse files
authored
Merge pull request topcoder-archive#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

app/listings/listings.controller.js

100644100755
Lines changed: 17 additions & 4 deletions
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
})()

app/listings/listings.jade

100644100755
Lines changed: 2 additions & 1 deletion
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"/>

app/listings/listings.module.js

100644100755
File mode changed.

app/listings/listings.routes.js

100644100755
File mode changed.

package.json

Lines changed: 1 addition & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy