Skip to content

Commit

Permalink
fix: pages should render properly after basket changes (login, addToB…
Browse files Browse the repository at this point in the history
…asket, ...)

* remove unnecassary session keep alive mechanism by reloading the basket
  • Loading branch information
Eisie96 committed Feb 6, 2023
1 parent c1054ca commit fd6aace
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/app/core/utils/api-token/api-token.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
import { BasketView } from 'ish-core/models/basket/basket.model';
import { User } from 'ish-core/models/user/user.model';
import { ApiService } from 'ish-core/services/api/api.service';
import { getCurrentBasket, getCurrentBasketId, loadBasket, loadBasketByAPIToken } from 'ish-core/store/customer/basket';
import { getCurrentBasket, getCurrentBasketId, loadBasketByAPIToken } from 'ish-core/store/customer/basket';
import { getOrder, getSelectedOrderId, loadOrderByAPIToken } from 'ish-core/store/customer/orders';
import {
fetchAnonymousUserToken,
Expand Down Expand Up @@ -149,23 +149,6 @@ export class ApiTokenService {
this.apiToken$.next(apiToken);
this.cookieVanishes$.next(type);
});

// session keep alive
appRef.isStable
.pipe(
whenTruthy(),
first(),
mergeMap(() =>
store.pipe(
select(getCurrentBasket),
switchMap(basket => interval(10 * 60 * 1000).pipe(map(() => !!basket)))
)
),
whenTruthy()
)
.subscribe(() => {
store.dispatch(loadBasket());
});
}
}

Expand Down

0 comments on commit fd6aace

Please sign in to comment.