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

Commit 4d459b5

Browse files
author
vikasrohit
committed
Merge branch 'feature/member-profiles-with-dot' into dev
2 parents 5f361e2 + 99b7f50 commit 4d459b5

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

app/profile/profile.controller.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import moment from 'moment'
2828
'COPILOT': 'copilot'
2929
}
3030

31-
logger.debug()
3231
vm.status = {
3332
'badges': CONSTANTS.STATE_LOADING,
3433
'stats': CONSTANTS.STATE_LOADING,

app/services/jwtInterceptor.service.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ import { isTokenExpired, getFreshToken } from 'tc-accounts'
2727
.catch(function(err) {
2828
// Server will not or cannot refresh token
2929
logger.debug('Unable to refresh V3 token, redirecting to login')
30-
var next = $state.href('dashboard', {}, {absolute: true})
31-
$window.location = CONSTANTS.ACCOUNTS_APP_URL + '?retUrl=' + encodeURIComponent(next)
3230

3331
return null
3432
})
@@ -82,10 +80,8 @@ import { isTokenExpired, getFreshToken } from 'tc-accounts'
8280

8381
// logger.debug('idToken: ' + idToken)
8482
if (!TcAuthService.isAuthenticated() || idToken == null) {
85-
// logger.debug('redirecting to accounts app')
86-
var next = $state.href('dashboard', {}, {absolute: true})
87-
$window.location = CONSTANTS.ACCOUNTS_APP_URL + '?retUrl=' + encodeURIComponent(next)
88-
return
83+
logger.debug(String.supplant('Skipping authToken for "{url}, UnAuthenticated user"', config))
84+
return null
8985
}
9086

9187
// Note only v3tokens expire

app/services/jwtInterceptor.service.spec.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,28 +78,24 @@ describe('JWT Interceptor Service', function() {
7878
expect(TcAuthService.isAuthenticated).to.be.have.been.calledOnce
7979
})
8080

81-
it('should redirect to login page for other endpoints', function() {
81+
it('should return null as token for other endpoints', function() {
8282
var config = {
8383
method: 'get',
8484
url: apiUrl + '/v3/members/test'
8585
}
86-
service.getToken(config)
87-
expect($window.location).not.null
88-
expect($window.location).to.have.string(CONSTANTS.ACCOUNTS_APP_URL)
86+
var token = service.getToken(config)
8987
expect(TcAuthService.isAuthenticated).to.be.have.been.calledOnce
90-
expect(fakeState.href).to.be.calledWith('dashboard')
88+
expect(token).to.be.null
9189
})
9290

93-
it('should redirect to login page for other endpoints', function() {
91+
it('should return null as token for other endpoints', function() {
9492
var config = {
9593
method: 'get',
9694
url: apiUrl + '/v3.0.0-BETA/members/test'
9795
}
98-
service.getToken(config)
99-
expect($window.location).not.null
100-
expect($window.location).to.have.string(CONSTANTS.ACCOUNTS_APP_URL)
96+
var token = service.getToken(config)
10197
expect(TcAuthService.isAuthenticated).to.be.have.been.calledOnce
102-
expect(fakeState.href).to.be.calledWith('dashboard')
98+
expect(token).to.be.null
10399
})
104100

105101
afterEach(function() {

webpack.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ const config = require('appirio-tech-webpack-config')({
3737
}
3838
})
3939

40+
if (process.env.ENV === 'DEV') {
41+
config.devServer = config.devServer ? config.devServer : {}
42+
config.devServer.proxy = [
43+
{
44+
path: /\/members\/.*/,
45+
bypass: function(req, res, proxyOptions) {
46+
return '/index.html'
47+
}
48+
}
49+
]
50+
}
51+
4052
if (CI) config.output.publicPath = process.env.ASSET_PREFIX
4153

4254
if (accountsAppURL) {

0 commit comments

Comments
 (0)