From 23bca3f448058a8e58c5428bb7991bf09fb39088 Mon Sep 17 00:00:00 2001 From: Johns Beharry Date: Sun, 28 Nov 2021 22:45:17 -0600 Subject: [PATCH] chore(app): note the queries for projects --- src/api/index.ts | 59 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index e2b4404..aeb5bea 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,29 +1,52 @@ import { Project, ProjectCard, ProjectCategory } from "../utils/interfaces"; -import { gql } from "@apollo/client"; +import { gql, useQuery } from "@apollo/client"; import data from "./mockData.json"; export async function getAllCategories(): Promise { - let ALL_CATEGORIES = gql` - query GetCategories { - allCategories { - id - title - } - } - `; - - console.log(ALL_CATEGORIES) - + // let QUERY = gql` + // query GetCategories { + // allCategories { + // id + // title + // } + // } + // `; return data.categories; } export async function getHottestProjects(): Promise { + // let QUERY = gql` + // query { + // allProject { + // id + // cover_image + // thumbnail_image + // title + // website + // votes_count + // } + // } + // `; return data.projectsCards; } export async function getProjectsByCategory( categoryId: string ): Promise { + + // let QUERY = gql` + // query Categories($categoryId: Int!){ + // projectsByCategory(category_id: ${categoryId}) { + // id + // cover_image + // thumbnail_image + // title + // website + // lightning_address + // votes_count + // } + // } + // `; return data.projectsCards; } @@ -38,5 +61,17 @@ export async function getLatestProjects(): Promise< } export async function getProjectById(projectId: string): Promise { +// let QUERY = gql` +// query Project(projectId: String!) { +// getProject(id: $projectId) { +// id +// cover_image +// thumbnail_image +// title +// website +// votes_count +// } +// } +// `; return data.project; }