Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@commercetools/frontend-sdk

Package Overview
Dependencies
Maintainers
2
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools/frontend-sdk - npm Package Compare versions

Comparing version 1.0.7-alpha.0 to 1.1.0-alpha.0

8

CHANGELOG.md
## Version 1.1.0-alpha.0 (2022-12-05)
* Added error handling
## Version 1.0.7-alpha.0 (2022-12-05)

@@ -3,0 +11,0 @@

2

package.json
{
"name": "@commercetools/frontend-sdk",
"version": "1.0.7-alpha.0",
"version": "1.1.0-alpha.0",
"license": "UNLICENSED",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -99,3 +99,3 @@ import { fetcher } from "../helpers/fetcher";

}
): Promise<T> {
): Promise<T | Error> {
this.#throwIfNotConfigured();

@@ -113,15 +113,23 @@ let params = "";

}
return await this.#actionQueue.add<T>(() => {
return fetcher<T>(
this.#normaliseUrl(`${this.#endpoint}/frontastic/action/${actionName}${params}`),
{
method: "POST",
body: JSON.stringify(payload),
headers: {
'Frontastic-Locale': this.APILocale,
//'Commercetools-Locale': this.APILocale // TODO: unsupported, needs backend work
}
},
);
});
try {
const result = await this.#actionQueue.add<T>(() => {
return fetcher<T>(
this.#normaliseUrl(`${this.#endpoint}/frontastic/action/${actionName}${params}`),
{
method: "POST",
body: JSON.stringify(payload),
headers: {
'Frontastic-Locale': this.APILocale,
//'Commercetools-Locale': this.APILocale // TODO: unsupported, needs backend work
}
},
);
});
return result;
} catch (error) {
if (typeof error === "string") {
return new Error(error);
}
return error as Error;
}
}

@@ -139,7 +147,15 @@

return fetcher<T>(
this.#normaliseUrl(`${this.#endpoint}/page`),
options
)
try {
const result = fetcher<T>(
this.#normaliseUrl(`${this.#endpoint}/page`),
options
);
return result
} catch (error) {
if (typeof error === "string") {
return new Error(error);
}
return error as Error;
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc