@spree/storefront-api-v2-sdk
Version:
Node module to easily integrate your JavaScript or TypeScript application with Spree API V2. You can create an entirely custom Storefront in JS/TS with this package including one page checkout, Single Page Apps, PWAs and so on
15 lines (12 loc) • 579 B
text/typescript
import Http from '../Http'
import { IProductResult, IProductsResult } from '../interfaces/Product'
import { IQuery } from '../interfaces/Query'
import { Routes } from '../routes'
export default class Products extends Http {
public async list(params: IQuery = {}): Promise<IProductsResult> {
return await this.spreeResponse('get', Routes.productsPath(), {}, params) as IProductsResult
}
public async show(id: string, params: IQuery = {}): Promise<IProductResult> {
return await this.spreeResponse('get', Routes.productPath(id), {}, params) as IProductResult
}
}