diff --git a/src/shared/API/sdk/client.ts b/src/shared/API/sdk/client.ts index 0fe1aa04..91e9b139 100644 --- a/src/shared/API/sdk/client.ts +++ b/src/shared/API/sdk/client.ts @@ -2,7 +2,6 @@ import type { UserCredentials } from '@/shared/types/user'; import getStore from '@/shared/Store/Store.ts'; import { setAnonymousId } from '@/shared/Store/actions.ts'; -import showErrorMessage from '@/shared/utils/userMessage.ts'; import { type ByProjectKeyRequestBuilder, createApiBuilderFromCtpClient } from '@commercetools/platform-sdk'; import { type AnonymousAuthMiddlewareOptions, @@ -63,8 +62,6 @@ export class ApiClient { this.anonymConnection = this.createAnonymConnection(); } this.adminConnection = this.createAdminConnection(); - - this.init().catch(showErrorMessage); } private addAuthMiddleware( @@ -169,15 +166,6 @@ export class ApiClient { }; } - private async init(): Promise { - await this.apiRoot() - .get() - .execute() - .catch((error: Error) => { - showErrorMessage(error); - }); - } - public adminRoot(): ByProjectKeyRequestBuilder { return this.adminConnection; } diff --git a/src/widgets/Header/model/HeaderModel.ts b/src/widgets/Header/model/HeaderModel.ts index 86e3684d..f31c41fd 100644 --- a/src/widgets/Header/model/HeaderModel.ts +++ b/src/widgets/Header/model/HeaderModel.ts @@ -54,7 +54,6 @@ class HeaderModel { this.setLogoutButtonHandler(); this.setCartLinkHandler(); this.observeCartChange(); - this.setCartCount().catch(showErrorMessage); this.setChangeLanguageCheckboxHandler(); } @@ -79,12 +78,6 @@ class HeaderModel { }); } - private async setCartCount(): Promise { - const cart = await getCartModel().getCart(); - this.view.updateCartCount(cart.products.length); - return true; - } - private setCartLinkHandler(): void { const logo = this.view.getToCartLink().getHTML(); logo.addEventListener('click', (event) => {