MathiasKandelborg/TRUE-framework

View on GitHub
util/api/calls/getSingleProductFromSlug.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Product } from 'cms/Product'
import { getClient } from '..'
import singleProductFromSlug from '../queries/singleProductBySlug'

/**
 * @param {string} slug The category slug
 * @returns {Promise<Product>} The category provided by slug
 */
async function getSingleProductBySlug(slug: string): Promise<Product> {
  const data: Product = await getClient(false).fetch(singleProductFromSlug, {
    slug: `${slug}`
  })

  return data
}

export default getSingleProductBySlug