Skip to content

@shopware/[email protected]

Compare
Choose a tag to compare
@github-actions github-actions released this 27 Jun 11:30
· 217 commits to main since this release
a122c60

Major Changes

  • #871 1566f7a Thanks @patzick! - Read more about new major release: https://github.com/shopware/frontends/discussions/965

  • #1056 c729e70 Thanks @patzick! - Removed deprecations from the code:

    • onContextChanged function inside createAPIClient method. Use apiClient.hook("onContextChanged", ...) instead.
    • apiType flag from the createAPIClient. Use separate methods to create store and admin api clients
    • onAuthChange from the createAdminAPIClient. Use adminApiClient.hook('onAuthChange',...) instead

Minor Changes

  • #1039 2343012 Thanks @patzick! - We're exposing fetchOptions inside params of invoke method. You can now use ofetch features like timeout or signal with AbortController

    Example for the AbortController:

    const controller = new AbortController();
    
    const request = client.invoke("readContext get /context", {
      fetchOptions: {
        signal: controller.signal,
      },
    });
    
    controller.abort(); // At this point client will throw an error with the information, that the request has been cancelled
  • #560 9643e56 Thanks @patzick! - [createAdminAPIClient] ability to pass optional field credentials to be used as authentication method before invoking any Admin API endpoint.

  • #639 d60d062 Thanks @patzick! - Management of defaultHeaders. You can now set them on apiClient init or runtime.

    const apiClient = createApiClient({
      ...,
      defaultHeaders: {
        'sw-language-id': 'my-id',
      },
    });
    
    console.log('Debug default headers:', apiClient.defaultHeaders);
    
    // Change header runtime
    apiClient.defaultHeaders['sw-language-id'] = 'my-new-id';
    
    // Remove header runtime
    apiClient.defaultHeaders['sw-language-id'] = "";
    
    // Change multiple headers runtime
    apiClient.defaultHeaders.apply({
      'sw-language-id': 'another-id',
      'sw-currency-id': 'currency-id',
    })
  • #857 864616f Thanks @mdanilowicz! - Add error and success callbacks

Patch Changes