Skip to content

Commit

Permalink
feat(composables): Remove slice from apiInstance url (NTR)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdanilowicz authored and patzick committed Feb 9, 2023
1 parent b6770ba commit 50e74be
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-glasses-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-pwa/composables-next": patch
---

Return full url for storefrontURL
2 changes: 1 addition & 1 deletion packages/composables/src/useInternationalization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("useInternationalization", () => {
});

it("should return storefrontUrl", async () => {
const wrapper = shallowMount(Component, getMockProvide(url + "/"));
const wrapper = shallowMount(Component, getMockProvide(url));
expect(wrapper.vm.getStorefrontUrl()).toBe(url);
});

Expand Down
5 changes: 1 addition & 4 deletions packages/composables/src/useInternationalization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ export function useInternationalization(): UseInternationalizationReturn {
/**
* apiIntanceUrl - should be removed after resolving backend multi domains problems
*/
const apiIntanceUrl = apiInstance.config.endpoint
? apiInstance.config.endpoint.slice(0, -1)
: undefined;
return apiIntanceUrl ?? window.location.origin ?? "";
return apiInstance.config.endpoint ?? window.location.origin ?? "";
}

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/composables/src/useNewsletter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const getMockProvide = (mockedUrl: string | undefined) => ({
});

describe("useNewsletter", () => {
const wrapper = shallowMount(Component, getMockProvide(url + "/"));
const wrapper = shallowMount(Component, getMockProvide(url));
const email = "[email protected]";
const newsletterMockData = {
email: email,
Expand Down
2 changes: 1 addition & 1 deletion packages/composables/src/useSyncWishlist.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const getMockProvide = (mockedUrl: string | undefined) => ({
});

describe("useSyncWishlist", () => {
const wrapper = shallowMount(Component, getMockProvide(url + "/"));
const wrapper = shallowMount(Component, getMockProvide(url));
const mockedResolve = { apiAlias: "mock", success: true };
const mockedResponse = {
products: {
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt3-module/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default defineNuxtModule<ShopwareNuxtOptions>({
options: {
shopwareEndpoint:
moduleConfig.shopwareEndpoint ??
"https://demo-frontends.shopware.store/",
"https://demo-frontends.shopware.store",
shopwareAccessToken:
moduleConfig.shopwareAccessToken ?? "SWSCBHFSNTVMAWNZDNFKSHLAYW",
shopwareApiClient: {
Expand Down

0 comments on commit 50e74be

Please sign in to comment.