Is there a way to use query-string to filter through data from Sanity?
//sanity/queries/page.ts import { groq } from “next-sanity”; import { client } from “../lib/client”; import { Category, Component, License, Tag } from “@/types/types”; import qs from “query-string”; interface Query { category?: string; tag?: string; } export const getComponents = async (query: Query): Promise<Component[]> => { const url = qs.stringify({ query: { category: query.category, tag: query.tag, }, […]
Is there to use query-string to filter through data from Sanity?
//sanity/queries/page.ts import { groq } from “next-sanity”; import { client } from “../lib/client”; import { Category, Component, License, Tag } from “@/types/types”; import qs from “query-string”; interface Query { category?: string; tag?: string; } export const getComponents = async (query: Query): Promise<Component[]> => { const url = qs.stringify({ query: { category: query.category, tag: query.tag, }, […]