Skip to content

Commit

Permalink
Cleaning up session service
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-bizz committed Mar 6, 2024
1 parent 984efaa commit c3484bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
24 changes: 12 additions & 12 deletions src/common/services/session/session.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,24 @@ const session = /* @ngInject */ function ($cookies, $rootScope, $http, $timeout,
session: session,
sessionSubject: sessionSubject,
authClient: authClient, // Exposed for tests only
getRole: currentRole,
catchCreateAccountErrors: catchCreateAccountErrors,
clearCheckoutSavedData: clearCheckoutSavedData,
checkCreateAccountStatus: checkCreateAccountStatus,
createAccount: createAccount,
handleOktaRedirect: handleOktaRedirect,
signIn: signIn,
signOut: signOut,
downgradeToGuest: downgradeToGuest,
getRole: currentRole,
getOktaUrl: getOktaUrl,
removeOktaRedirectIndicator: removeOktaRedirectIndicator,
handleOktaRedirect: handleOktaRedirect,
hasLocationOnLogin: hasLocationOnLogin,
isOktaRedirecting: isOktaRedirecting,
updateCurrentProfile: updateCurrentProfile,
oktaIsUserAuthenticated: oktaIsUserAuthenticated,
updateCurrentProfile: updateCurrentProfile,
updateCheckoutSavedData: updateCheckoutSavedData,
clearCheckoutSavedData: clearCheckoutSavedData,
checkCreateAccountStatus: checkCreateAccountStatus,
removeOktaRedirectIndicator: removeOktaRedirectIndicator,
removeLocationOnLogin: removeLocationOnLogin,
hasLocationOnLogin: hasLocationOnLogin,
signOutWithoutRedirectToOkta: signOutWithoutRedirectToOkta,
catchCreateAccountErrors: catchCreateAccountErrors
signIn: signIn,
signOut: signOut,
signOutWithoutRedirectToOkta: signOutWithoutRedirectToOkta
}

function handleOktaRedirect (lastPurchaseId) {
Expand Down Expand Up @@ -147,7 +147,7 @@ const session = /* @ngInject */ function ($cookies, $rootScope, $http, $timeout,
const email = isAuthenticated && (await authClient.getUser()).email
return {
status: 'error',
data: [`Already logged in to Okta${email ? ` with email: ${email}` : ''}. You will be redirected to the Sign In page in a few seconds.`, 'Another Error'],
data: [`Already logged in to Okta${email ? ` with email: ${email}` : ''}. You will be redirected to the Sign In page in a few seconds.`],
redirectToSignIn: true
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/common/services/session/session.service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,7 @@ describe('session service', function () {
expect(getUser).toHaveBeenCalled();
expect(data).toEqual({
data: [
"Already logged in to Okta with email: [email protected]. You will be redirected to the Sign In page in a few seconds.",
"Another Error"
"Already logged in to Okta with email: [email protected]. You will be redirected to the Sign In page in a few seconds."
],
redirectToSignIn: true,
status: "error"
Expand All @@ -630,8 +629,7 @@ describe('session service', function () {
sessionService.createAccount('test@[email protected]', 'FirstName', 'LastName').then((data) => {
expect(data).toEqual({
data: [
"Already logged in to Okta. You will be redirected to the Sign In page in a few seconds.",
"Another Error"
"Already logged in to Okta. You will be redirected to the Sign In page in a few seconds."
],
redirectToSignIn: true,
status: "error"
Expand Down

0 comments on commit c3484bf

Please sign in to comment.