MathiasKandelborg/TRUE-framework

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

Summary

Maintainability
A
0 mins
Test Coverage
import { Category } from 'cms/Category'
import { getClient } from '..'
import categoryBySlug from '../queries/singleCategoryBySlug'

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

  return data
}

export default getCategoryBySlug