import apollo from "../../lib/apollo.js"; async function GetNews(token="", start = 0) { var res = await apollo.query( ` query($start: Int!) { latestNews(limit:6,start:$start) { id title description img{ url } published_at } } `, token, { start: start, } ); return res; } async function GetOtherNews(token="", start = 0) { var res = await apollo.query( ` query($start: Int!) { latestNews(limit:3,start:$start) { id title description img{ url } published_at } } `, token, { start: start, } ); return res; } async function GetDetailNews(id, token="") { var res = await apollo.query( ` query($input: ID!) { latestNews(where:{id:$input}) { id title description img{ url } published_at } } `, token, { "input": id } ); return res; } module.exports = { GetNews: GetNews, GetDetailNews: GetDetailNews, GetOtherNews:GetOtherNews, };