Skip to content

Commit 1bb80d5

Browse files
committed
fix type errors
1 parent bc97910 commit 1bb80d5

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/project/project.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class ProjectComponent extends DataLoadingComponent implements OnInit {
5757
subscriber.next(projectId);
5858
});
5959
userDoc.remoteChanges$.pipe(quietTakeUntilDestroyed(this.destroyRef)).subscribe(() => {
60-
subscriber.next(projectId);
60+
subscriber.next(projectId ?? '');
6161
});
6262
});
6363

src/SIL.XForge.Scripture/ClientApp/src/xforge-common/auth.service.spec.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
GenericError,
66
GetTokenSilentlyVerboseResponse,
77
RedirectLoginOptions,
8+
ResponseType,
89
TimeoutError
910
} from '@auth0/auth0-spa-js';
1011
import { CookieService } from 'ngx-cookie-service';
@@ -211,11 +212,13 @@ describe('AuthService', () => {
211212
[XF_ROLE_CLAIM]: undefined,
212213
[XF_USER_ID_CLAIM]: TestEnvironment.userId
213214
}),
214-
expires_in: 720
215+
expires_in: 720,
216+
token_type: 'Bearer'
215217
},
216218
idToken: { __raw: '1', sub: '7890', email: '[email protected]' },
217219
loginResult: {
218-
appState: JSON.stringify({ returnUrl: '' })
220+
appState: JSON.stringify({ returnUrl: '' }),
221+
response_type: ResponseType.Code
219222
}
220223
}
221224
});
@@ -236,11 +239,13 @@ describe('AuthService', () => {
236239
[XF_ROLE_CLAIM]: SystemRole.SystemAdmin,
237240
[XF_USER_ID_CLAIM]: TestEnvironment.userId
238241
}),
239-
expires_in: 720
242+
expires_in: 720,
243+
token_type: 'Bearer'
240244
},
241245
idToken: { __raw: '1', sub: '7890', email: '[email protected]' },
242246
loginResult: {
243-
appState: JSON.stringify({ returnUrl: '' })
247+
appState: JSON.stringify({ returnUrl: '' }),
248+
response_type: ResponseType.Code
244249
}
245250
}
246251
});
@@ -261,11 +266,13 @@ describe('AuthService', () => {
261266
[XF_ROLE_CLAIM]: [SystemRole.SystemAdmin, SystemRole.User],
262267
[XF_USER_ID_CLAIM]: TestEnvironment.userId
263268
}),
264-
expires_in: 720
269+
expires_in: 720,
270+
token_type: 'Bearer'
265271
},
266272
idToken: { __raw: '1', sub: '7890', email: '[email protected]' },
267273
loginResult: {
268-
appState: JSON.stringify({ returnUrl: '' })
274+
appState: JSON.stringify({ returnUrl: '' }),
275+
response_type: ResponseType.Code
269276
}
270277
}
271278
});
@@ -810,8 +817,8 @@ class TestEnvironment {
810817
static userId = 'user01';
811818
auth0Response: AuthDetails | undefined = {
812819
idToken: undefined,
813-
loginResult: { appState: JSON.stringify({}) },
814-
token: { id_token: '', access_token: '', expires_in: 0 }
820+
loginResult: { appState: JSON.stringify({}), response_type: ResponseType.Code },
821+
token: { id_token: '', access_token: '', expires_in: 0, token_type: 'Bearer' }
815822
};
816823
readonly service: AuthService;
817824
readonly language = 'fr';
@@ -950,7 +957,8 @@ class TestEnvironment {
950957
[XF_ROLE_CLAIM]: SystemRole.SystemAdmin,
951958
[XF_USER_ID_CLAIM]: TestEnvironment.userId
952959
}),
953-
expires_in: this.tokenExpiryTimer
960+
expires_in: this.tokenExpiryTimer,
961+
token_type: 'Bearer'
954962
};
955963
}
956964

@@ -990,7 +998,8 @@ class TestEnvironment {
990998
token: this.validToken,
991999
idToken: { __raw: '1', sub: '7890', email: '[email protected]' },
9921000
loginResult: {
993-
appState: this._authLoginState
1001+
appState: this._authLoginState,
1002+
response_type: ResponseType.Code
9941003
}
9951004
};
9961005
this.auth0Response = auth0Response;

src/SIL.XForge.Scripture/ClientApp/src/xforge-common/auth.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
AuthorizationParams,
66
CacheEntry,
77
CacheKey,
8+
ConnectAccountRedirectResult,
89
GetTokenSilentlyVerboseResponse,
910
IdToken,
1011
LogoutOptions,
@@ -57,7 +58,7 @@ export interface AuthState {
5758

5859
export interface AuthDetails {
5960
idToken: IdToken | undefined;
60-
loginResult: RedirectLoginResult;
61+
loginResult: RedirectLoginResult | ConnectAccountRedirectResult;
6162
token: GetTokenSilentlyVerboseResponse;
6263
}
6364

@@ -459,7 +460,8 @@ export class AuthService {
459460
return { loggedIn: true, newlyLoggedIn: false, anonymousUser: false };
460461
}
461462
// Handle the callback response from auth0
462-
const loginResult: RedirectLoginResult = await this.auth0.handleRedirectCallback();
463+
const loginResult: RedirectLoginResult | ConnectAccountRedirectResult =
464+
await this.auth0.handleRedirectCallback();
463465
const token = await this.checkSession();
464466
if (token == null) {
465467
this.clearState();

src/SIL.XForge.Scripture/ClientApp/src/xforge-common/auth0.service.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ describe('Auth0Service', () => {
5454
id_token: '',
5555
access_token: '',
5656
scope: '',
57-
expires_in: 0
57+
expires_in: 0,
58+
token_type: 'Bearer'
5859
};
5960
when(
6061
mockedHttpClient.post(

0 commit comments

Comments
 (0)