Giter Club home page Giter Club logo

spree-api-v2-js-sdk's Introduction

Spree Commerce API v2 JavaScript / TypeScript SDK

A set of packages to easily integrate your JavaScript or TypeScript application with Spree API. You can create an entirely custom Storefront in JS/TS with Storefront SDK package including one page checkout, Single Page Apps, PWAs and so on.

Developed and maintained by:

Vendo

All-in-one platform for all your Marketplace and B2B eCommerce needs. Start your 30-day free trial

Documentation

To check out the docs, visit spree-sdk.upsidelab.io.

About Vendo

Vendo is a great fit for marketplaces of all sizes - either with own fulfillment and multiple warehouses or in a dropshipping model. Vendo automates everything from vendor onboarding, accepting buyer payments in over 135 currencies, to supplier payouts in 50 countries.

Vendo ensures excellent buyer experience with smooth product discovery and search, a multitude of payment methods and optimal shipping cost calculation. Vendo keeps suppliers happy with easy onboarding, automated products sync using their preferred method and easy payouts.

Start your 30-day free trial

spree-api-v2-js-sdk's People

Contributors

aplegatt avatar arudnicka avatar bezsmertnyiigor avatar damianlegawiec avatar ddombrowsky avatar dependabot-preview[bot] avatar dependabot[bot] avatar estebanborai avatar fpdrozd avatar igorbezsmertnyi avatar kacpermekarski avatar nischay-webonise avatar rafalcymerys avatar rafalkosla101 avatar shigawire avatar shimma avatar tniezg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spree-api-v2-js-sdk's Issues

Host is resolving to localhost

Context

const client = makeClient({
    host: 'https://madeup-api.herokuapp.com'
});

client.authentication.getToken({
    username: '[email protected]',
    password: 'pass',
}).then(data => (console.log('result: ', data.fail(), data.success())))

I'm seeing this error below in the chrome console:
POST http://localhost:3000/spree_oauth/token

Expected Behavior

POST https://madeup-api.herokuapp.com/spree_oauth/token

Your Environment

Create-react-app

  • Library version: 2.1.2
  • Node and yarn/npm version: yarn 1.13 node 10.13
  • Browser version: latest chrome
  • Operating system: osx

It seems like this is not working properly

in HTTPS
this.host = process.env.SPREE_HOST || 'http://localhost:3000/'

Add discontinue_on to the VariantAttributes object

Is your feature request related to a problem? Please describe.

Given discontinue_on is settable for a variant in admin panel it should be returned in VariantAttributes object

Describe the solution you'd like.

.

Describe alternatives you've considered.

.

Additional context

.

Export storefrontPath from src/routes.ts

Is your feature request related to a problem? Please describe.

When extending Client with extra endpoints, it's useful to have the standard path for APIv2 requests and routes to existing endpoints already provided by the SDK.

Describe the solution you'd like.

Export routes.ts values.

Describe alternatives you've considered.

-

Additional context

-

Use TravisCI to make sure the SDK builds

Is your feature request related to a problem? Please describe.

SDK builds two bundles. Let's ensure we don't forget that both have to build successfully before another package version is released.

Describe the solution you'd like.

Basic yarn build of every new PR and master branch

Describe alternatives you've considered.

-

Additional context

-

Endpoints not exposed in distributed build of 4.0.6

If I understand #135 correctly it should now expose a endpoints object in the root that contains all the endpoint classes (Account, Authentication, etc) but it's not there.

console.log(require('@spree/storefront-api-v2-sdk')); // @4.0.6

Screen Shot 2020-04-14 at 12 27 50

Add image transformation params to products endpoints

Is your feature request related to a problem? Please describe.

The Spree SDK must suggest image_transformation[size] and image_transformation[quality] when calling client.products.show and client.products.list. These two parameters can be supplied to Spree so it returns product images in a different format than the formats defined by Spree::Image or its decorator.

Describe the solution you'd like.

Add TypeScript extending the IQuery parameter in client.products.show and client.products.list to suggest image_transformation[size] and image_transformation[quality].

Describe alternatives you've considered.

-

Additional context

The image_transformation parameter was added to Spree in spree/spree#11264.

Make Routes inside src/routes.ts lowercase

It's a plain object. The current name breaks conventions.

Context

Expected Behavior

Possible Fix

Your Environment

  • Library version:
  • Node and yarn/npm version:
  • Browser version:
  • Operating system:

Include helper functions handling JSON:API responses

Is your feature request related to a problem? Please describe.

There are a few JSON:API functions we use in all projects reliant on the Spree SDK library. To reduce duplication, we're including them in the SDK.

Describe the solution you'd like.

The Spree SDK exposes import { jsonApi } from '@spree/storefront-api-v2-sdk'. jsonApicontains three helper functions for processing responses from Spree which have theincluded` key filled with JSON:API documents.

Describe alternatives you've considered.

  • External libraries for managing JSON:API.
  • GitHub gists and examples at Code Sandbox which could be copied to projects.

Additional context

-

Replace tsyringe dependency injection

We're currently using tsyringe to provide all the endpoint methods in the client. I think it's time to remove it.

Is your feature request related to a problem? Please describe.

Bug

Describe the solution you'd like.

tsyringe is useful for dependency injection when dependencies are added to a "main" object. In our case, the client is merely a collector of various endpoint methods. In our case, tsyringe's abilities fall short. This bug emphasises the difference.

Removing tsyringe will reduce complexity, duplication and reduce the SDK's size. Especially after resolving #85 with #86. Instead of using tsyringe, let's instantiate endpoint classes directly and however we want.

Describe alternatives you've considered.

  • Reconfigure tsyringe to inject host value to all classes inheriting from Http. Using @inject on subclasses of Http worked but didn't work when trying to inject into Http. It seems classes don't inherit the runtime @inject decorator.
  • Have endpoint classes pull the host themselves. Couldn't figure out how to easily have them do that without using globals or some other indirect solution.

Update Browserslist package

Is your feature request related to a problem? Please describe.

Support newer browsers.

Describe the solution you'd like.

-

Describe alternatives you've considered.

-

Additional context

-

Compatibility issue with Expo

Hello,

I'm writing a mobile app with react native using the expo framework and when using this extension I'm getting the following error:

The package at "node_modules/source-map-support/source-map-support.js" attempted to import the Node standard library module "path". It failed because React Native does not include the Node standard library. Read more at https://docs.expo.io/versions/latest/introduction/faq.html#can-i-use-nodejs-packages-with-expo

I installed the package using npm and this is my declaration inside my project

import { makeClient } from '@spree/storefront-api-v2-sdk'


const client = makeClient({
  host: MAIN_URL
})

Thanks for any help.

Remove dependency on source-map-support

Using the server SDK in a project produces a warning:

WARNING in ./node_modules/source-map-support/source-map-support.js
Module not found: Error: Can't resolve 'module' in '/projects/spark-starter-kit/node_modules/source-map-support'

Parsing source maps in the SDK should be a choice by the project devs.

Context

-

Expected Behavior

-

Possible Fix

-

Your Environment

  • Webpack, importing dist/server package.

Switch to Rollup from Webpack

Is your feature request related to a problem? Please describe.

TBD

Describe the solution you'd like.

  • Remove dependency on Webpack
  • Use Rollup to generate UMD and ESM bundles
  • Update Quick start in README.md: describe how to use UMD and ESM bundles, mention they don't contain axios and qs
  • Adjust tests to use Rollup

Describe alternatives you've considered.

Stick with Webpack. Webpack is not the best at making code concise and is working on supporting ESM. Switching to Rollbar may be a good choice considering Spree SDK is not a complete project but a library.

Additional context

-

Request Function Sdk for Get All User Orders

Is your feature request related to a problem? Please describe.

Hi, I'm one of the developers who used your sdk. I got a problem when trying to Get All User Orders from your sdk, I've searched on your documentation and it seems that we don't capable to Get All User Orders by using your sdk.

Describe the solution you'd like.

Is it possible for you to develop this? to Get All User Orders by using your sdk

Request Filter Params on Get All User Orders

Is your feature request related to a problem? Please describe.

Hi, I'm one of the developers who used your platform Spree Commerce. I got a problem when trying to filtered out User Orders (shipment / payment status) from your API, I've searched on your documentation and it seems that we don't capable to filtered out User Orders.

Describe the solution you'd like.

Is it possible for you to develop this? to filtered out User Orders

Additional context

It would made the pagination better if the user has a lot of orders

minified dist/server/index.js throws error with `next build`

Context

Please forgive my frustration, as I'm unsure where the root cause of this error even is.

After upgrading spree SDK to latest (4.7.2), I am unable to build my site.

To make a test build, I normally run npx next build, and that pre-compiles everything.

info  - Using external babel configuration from /home/davek/work/instinct/dna/dna-frontend/.babelrc
info  - Creating an optimized production build
Failed to compile.

./node_modules/@spree/storefront-api-v2-sdk/dist/server/index.js 1:521
Module parse failed: Unexpected token (1:521)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> 

... minified js file removed ...

> Build error occurred
Error: > Build failed because of webpack errors
    at /home/davek/work/instinct/dna/dna-frontend/node_modules/next/dist/build/index.js:15:918
    at async /home/davek/work/instinct/dna/dna-frontend/node_modules/next/dist/build/tracer.js:1:1441


Does anyone have any idea what the root cause is? I'm not even sure if it is babel or webpack or what is trying to parse this minified file, nor can I divine a configuration that will set it to be ignored from building (assuming that would even work, which it probably would not).

versions:

  • webpack 4.46.0
  • next 10.0.6
  • storefront-api-v2-sdk 4.7.2

Host dist/client/index.js on a public CDN

Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is, ex. "I'm always frustrated when [...]".

Describe the solution you'd like.

A clear and concise description of what you want to happen.

Describe alternatives you've considered.

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

Use Spree Starter to run e2e tests

Is your feature request related to a problem? Please describe.

The latest version of Spree, 4.2.1, removes the Docker configuration from its repository in favour of https://github.com/spree/spree_starter. The e2e tests in the Spree SDK rely on the old Docker configuration included with Spree. In order to test the Spree SDK reliably, we should switch to Spree Starter as well.

Describe the solution you'd like.

Integrate Spree Starter with the Docker Compose configuration used to run e2e tests in the Spree SDK.

Describe alternatives you've considered.

Copy the old Docker configuration from old Spree versions and run the newest Spree version using it. Would require more maintenance than relying on Spree Starter which already contains what's needed. Also, switching to PostgreSQL from SQLite, which Spree Starter does, creates a more production-like environment during testing. SQLite doesn't have the exact same features as PostgreSQL and is less reliable.

Additional context

-

Improve use of positional arguments in endpoints' methods

We need the Spree SDK to be more robust and support different modifications to Spree stores with lower development effort. To achieve this, we need to make fewer assumptions about Spree's APIs. Moving forward, we'll be switching to a more object based approach instead of using positional arguments when calling the SDK's methods.

Fix `sort` param interface

Context

  • Taxons are not sortable, readme shows they are
  • Sort doesn't exist in IQuery

Expected Behavior

-

Possible Fix

-

Your Environment

-

Allow IQuery to accept any extra keys

Is your feature request related to a problem? Please describe.

Extending the Client class to allow extra keys in requests is a coarse solution. Allowing any key-value in IQuery allows using Spree with extra extensions without the need to extend.

Describe the solution you'd like.

Change TypeScript IQuery interface to suggest standard APIv2 keys but also any additional key necessary.

Describe alternatives you've considered.

  • Override or replace existing endpoint methods.
  • Extend Client.

Additional context

-

Use new `@babel/typescript` preset instead of `ts-loader`

Is your feature request related to a problem? Please describe.

  • There's an issue with named exports being ignored in TS: TypeStrong/ts-loader#697. Can lead to missing import errors during development in webpack --watch mode.
  • Two loaders are used and on the same thread. Slower than it could be.

Describe the solution you'd like.

Use similar approach as in https://github.com/facebook/create-react-app with @babel/typescript and https://github.com/Realytics/fork-ts-checker-webpack-plugin

Describe alternatives you've considered.

  • Add extra import statements inside files.
  • Modify tsconfig.json and ts-loader configs to have babel-loader recognize missing .ts files.

Additional context

-

Fix /types regeneration when using `npm run watch`

Context

Related to #63. After initial bundle, every .ts file with just TS interfaces gets ignored. Since we started clearing /types before bundle regens, these files end up missing when developing the SDK and cause errors.

Expected Behavior

  • Force Webpack to regen all .d.ts files, including those with just interfaces.

Possible Fixes

A. add generic import <...>.ts everywhere an interface file is loaded (maaaany places)
B. somehow fix how Webpack regens /types, but difficult due to issues reported in #63

Your Environment

-

Add helper for automatically refreshing the access token when making any Storefront API request

Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is, ex. "I'm always frustrated when [...]".

Describe the solution you'd like.

A clear and concise description of what you want to happen.

Describe alternatives you've considered.

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

Use generics instead of type casting in endpoints

Is your feature request related to a problem? Please describe.

All data returned by Spree must be typed in TypeScript. Doing so makes it easier to use in projects written in TypeScript that use the SDK. The current solution uses explicit typecasting to set the returned type. Using generics is safer.

Describe the solution you'd like.

Change return (await this.spreeResponse('patch', routes.checkoutNextPath(), token, params)) as IOrderResult into
return (await this.spreeResponse<IOrder>('patch', routes.checkoutNextPath(), token, params)).

Describe alternatives you've considered.

-

Additional context

-

Allow all endpoints to send IToken

Is your feature request related to a problem? Please describe.

TBD

Describe the solution you'd like.

TBD

Describe alternatives you've considered.

TBD

Additional context

TBD

Authentication request type seems wrong

We are building a Nuxt frontend for Spree. We are using official SDK (latest version)
For authentication SDK sends OPTIONS request to backend and it gives 404. On documentation i see it shoult be POST request

Context

Authentication request being sent to api/v2 with OPTIONS request and backend gives 404 for OPTIONS request.

Expected Behavior

Possible Fix

Change the request type to POST request

Your Environment

  • Library version:
  • Node and yarn/npm version:
  • Browser version:
  • Operating system:

Expose Account, Authentication, Cart, Checkout, Countries, Order, Products & Taxons inside src/index.ts so they can be easily extended in the front-end.

Is your feature request related to a problem? Please describe.

The SDK is exported in two formats: for front- and back-end use. Back-end can import anything from /src. Front-end only has access to everything exported in /src/index.ts. Having access to endpoints makes extending Client easier.

Describe the solution you'd like.

-

Describe alternatives you've considered.

-

Additional context

-

Option to use fetch instead of axios

Is your feature request related to a problem? Please describe.

fetch (native or polyfilled) is already common in many NodeJS and front-end projects. It will be useful to reuse existing fetch instead of requiring axios in the SDK.

Describe the solution you'd like.

Require axios by default but allow configuring the SDK's client to use fetch instead. If fetch is configured and not available, throw an error. Allow providing a specific fetch implementation instead of global or require('fetch').

Describe alternatives you've considered.

Leaving axios as the only option. axios is a popular package. But having the ability to switch can decrease the bundle size of the entire project and provide fetch responses which the project already handles.

Additional context

-

Update `account.create` parameters to be more explicit instead if IQuery

Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is, ex. "I'm always frustrated when [...]".

Describe the solution you'd like.

A clear and concise description of what you want to happen.

Describe alternatives you've considered.

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

Cannot filter by product name

Context

Hi, I'm used your platform Spree Commerce. I got a problem when trying to filtered by name. I'm get the response without products. The rest of the filter works fine.

I send this:
createClient().products.list({ filter: { name: "Bolso" } })
/api/v2/storefront/products?filter[name]=bolso

But I receive this:
{ "data": [], "meta": { "count": 0, "total_count": 0, "total_pages": 0 }, "links": { .... } }

Expected Behavior

You should receive the following json ,since the product is in the data among many others.

{
    "data": [
       {
            "id": "2",
            "type": "product",
            "attributes": {
                "name": "Bolso nudos",
                "description": null,
                "available_on": "2021-08-05T00:00:00.000-05:00",
                "slug": "bolso-nudos",
                "meta_description": null,
                "meta_keywords": null,
                "updated_at": "2021-08-11T05:10:35.841-05:00",
                "purchasable": true,
                "in_stock": true,
                "backorderable": true,
                "available": true,
                "currency": "USD",
                "price": "120.00",
                "display_price": "$120.00",
                "compare_at_price": null,
                "display_compare_at_price": null
            },
            "relationships": {
                "variants": {
                    "data": [
                        {
                            "id": "8",
                            "type": "variant"
                        }
                    ]
                },
                "option_types": {
                    "data": [
                        {
                            "id": "2",
                            "type": "option_type"
                        }
                    ]
                },
                "product_properties": {
                    "data": []
                },
                "taxons": {
                    "data": [
                        {
                            "id": "3",
                            "type": "taxon"
                        }
                    ]
                },
                "images": {
                    "data": [
                        {
                            "id": "4",
                            "type": "image"
                        }
                    ]
                },
                "default_variant": {
                    "data": {
                        "id": "8",
                        "type": "variant"
                    }
                },
                "vendor": {
                    "data": {
                        "id": "1",
                        "type": "vendor"
                    }
                }
            }
        }
    ],
    "meta": {
        "count": 1,
        "total_count": 1,
        "total_pages": 1
    },
    "links": {
       ....
    }
}

Your Environment

  • Library version: ^4.5.4
  • Node and yarn/npm version: Node: v16.6.0 - Yarn: 1.22.10
  • Operating system: Big Sur

Spree api v2 always generate token in each request

Spree Rest API v2 regenerate access token in each request, this means that access token need to be generate at the client side as well, for example:

  1. User logins in into the app using username and password as described here: https://github.com/spree/spree-storefront-api-v2-js-sdk#gettoken.
  2. We get the response token (access token, refresh token and other things). We save the response token in a persistent storage.
  3. Client sends a request to an endpoint for example product details endpoint using access token we saved in the persistent storage , the server process the request and then regenerate the access token.
  4. Client sends another request to the server, As server regenerated access token then our current access token in the storage is no longer valid. we have to get the new access token using refresh token. So we will end up generating access token using refresh token before sending to an endpoint, i.e we are required to call two requests.

Is this too overloaded? The server regenerate the access_token, in case of this lib, we also have to generate the access token making number of access token records created twice in the server.

Is there any approach to handling this? This is the case I face to build an app in flutter using Spree REST Api v2.

Describe the solution you'd like.

I think it is better to allow client to generate token with JWT, and then the server validate the token using secret key shared by client and server. The token can be generated every time by the client before sending request to the server.

[Question] How to access easily to image urls from Products(list) API?

Hi there,
this is a question issue.

Is there some simple way to access easily to image urls from Products list API?

I wrote an accessing code, but it is a bit complex.

<template>
  <div>
    <div v-for="product in products" :key="product.id">
      <p>
        {{ product.id }}
        {{ product.attributes.name }}
        <img :src="product.image.attributes.styles[4].url" />
      </p>
    </div>
  </div>
</template>

<script>

import { makeClient } from '@spree/storefront-api-v2-sdk/dist/client'
export default {
  data(){
    return {
      loading: true,
      products: [],
    }
  },

  mounted() {
    (async() => {
      const client = makeClient({
        host: 'http://localhost:3000',
      })
      const response = await client.products.list({
        include: 'images',
        page: 1,
      })
      const success  = response.success();
      const products = success.data;
      const images   = success.included;

      // a bit complex ...
      products.forEach((p, _i) => {
        const image_id = p.relationships.images.data[0].id;
        const found_image = images.find(image => image.id === image_id);
        p.image = found_image;
      })

      this.products = products;
    })();
  },
}
</script>

This seems to work, but it feels verbose.

Is there an easy way to access OpenAPI relationships with JavaScript props and functions?

I also found way to use a npm module jsonapi-deserializer , and this seems to work, too.

<template>
  <div>
    <div v-for="product in products" :key="product.id">
      <p>
        {{ product.id }}
        {{ product.name }}
        <img :src="product.images[0].styles[4].url" />
      </p>
    </div>
  </div>
</template>

<script>

import { makeClient } from '@spree/storefront-api-v2-sdk/dist/client'
import { deserialize } from 'jsonapi-deserializer';
export default {
  data(){
    return {
      loading: true,
      products: [],
    }
  },

  mounted() {
    (async() => {
      const client = makeClient({
        host: 'http://localhost:3000',
      });
      const response = await client.products.list({
        include: 'images',
        page: 1,
      });
      const success  = response.success();
      const products = deserialize(success);
      this.products = products;
    })();
  },
}
</script>

Is it normal to use an external module for deserialization like this?

How do you solve some kind of this, folks?

Support default currency and locale `Client` options and allow customising for specific requests

Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is, ex. "I'm always frustrated when [...]".

Describe the solution you'd like.

A clear and concise description of what you want to happen.

Describe alternatives you've considered.

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

Add Doorkeeper token revocation endpoint

https://github.com/doorkeeper-gem/doorkeeper/blob/main/app/controllers/doorkeeper/tokens_controller.rb#L16

Is your feature request related to a problem? Please describe.

Calling the token revocation endpoint is necessary to deactivate all tokens owned by a user that's trying to log out of a website. Doing so improves the security of the website. The tokens are deactivated immediately instead of naturally after reaching their expiration period which for refresh tokens can take a long time and isn't standardised.

Describe the solution you'd like.

Add an auth endpoint to the SDK which calls Doorkeeper's token revoke endpoint included with Spree.

Describe alternatives you've considered.

Use tokens with a shorter expiration time. This is a highly variable setting and differs between websites. We can't assume that tokens will expire in a short time. It's often not a matter of security but the how tokens are used. Longer expiration times are sometimes needed.

Additional context

Auth0's JS library also expires tokens when logging out users.

Make addEndpoints() public for easier customization of existing endpoints

Is your feature request related to a problem? Please describe.

Overriding existing endpoint classes in Client requires overriding its constructor and rewriting a significant amount of existing code. A shorter solution is needed.

Describe the solution you'd like.

Allow specific standard Spree endpoints to be extended/replaced.

Describe alternatives you've considered.

-

Additional context

-

Account creation is documented but not supported by API

Hi, I was just trying to create an account with client.account.create() as documented in the README but the API was responding with an infinite redirection. When I went to check the API routes, there're only routes for getting account information, orders and credit cards, so now I'm confused. Could you clarify this is actually meant to be supported?

Add methods for handling Platform endpoints

Is your feature request related to a problem? Please describe.

We won't add all Spree Platform API endpoints to the SDK. But endpoints for managing standard CRUD operations have the same signatures. So, we'll start with adding those.

Describe the solution you'd like.

A clear and concise description of what you want to happen.

Describe alternatives you've considered.

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

Cannot include logged-in user token when fetching product list

Context

There appears to be no way to pass an auth token along with a call to list products. Because of this, the back end cannot determine which user is requesting the product list, preventing me from implementing members-only pricing or products.

e.g. this code

  const response = await spreeClient.products.list({
    include: "images",
    bearerToken: token ? token.access : undefined
  });

will not pass through the bearerToken.

Expected Behavior

The request should include the Authorize: header field, as it does with the cart operations.

Possible Fix

The API call should be updated to include the optional parameter.

Your Environment

  • Library version: 4.4.3
  • Node and yarn/npm version: node 14.15.4, npm 7.20.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.