Skip to content

Commit

Permalink
fix: handle multitab browsing (#1465)
Browse files Browse the repository at this point in the history
When browsing the site using different tabs, the identification status is not well persisted across
tabs. This is particularly annoying when a user opens several tabs to compare products before adding
them to the shopping cart.

The following fix corrects these problems

* Optimize cookie check routine, when a new apiToken is created

* refactor: remove 'anonmous' api token cookie type functionality

* refactor: method naming, typing within apiToken service

---------

Co-authored-by: Marcel Eisentraut <meisentraut@intershop.de>
  • Loading branch information
tbouliere-datasolution and Eisie96 committed Sep 5, 2023
1 parent 2a895a2 commit d5f749c
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 180 deletions.
5 changes: 0 additions & 5 deletions src/app/core/facades/account.facade.ts
Expand Up @@ -38,7 +38,6 @@ import {
import {
createUser,
deleteUserPaymentInstrument,
fetchAnonymousUserToken,
getCustomerApprovalEmail,
getLoggedInCustomer,
getLoggedInUser,
Expand Down Expand Up @@ -103,10 +102,6 @@ export class AccountFacade {
options?.revokeApiToken ? this.store.dispatch(logoutUser()) : this.store.dispatch(logoutUserSuccess());
}

fetchAnonymousToken() {
this.store.dispatch(fetchAnonymousUserToken());
}

createUser(body: CustomerRegistrationType) {
this.store.dispatch(createUser(body));
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/identity-provider/icm.identity-provider.ts
Expand Up @@ -33,7 +33,7 @@ export class ICMIdentityProvider implements IdentityProvider {
init() {
this.apiTokenService.restore$().subscribe(noop);

this.apiTokenService.cookieVanishes$.subscribe(([type]) => {
this.apiTokenService.cookieVanishes$.subscribe(type => {
this.accountFacade.logoutUser({ revokeApiToken: false });
if (type === 'user') {
this.router.navigate(['/login'], {
Expand Down

0 comments on commit d5f749c

Please sign in to comment.