|
- import apollo from "../../lib/apollo.js";
-
- async function GetDetailProduct(id, token = "") {
- var res = await apollo.query(
- `
- query($input: ID!){
- products(where:{id:$input})
- {
- name
- price
- description
- img{
- url
- }
- overview
- specification
- film
- stock
- }
- } `,
- token, {
- "input": id
- }
- );
- return res;
- }
-
- async function GetProductMatic(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { categories: "matic" }) {
- id
- name
- price
- img {
- url
- }
- }
- }`,
- token
- );
- return res;
- }
-
- async function GetProductMaxi(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { categories: "maxi" }) {
- id
- name
- price
- img {
- url
- }
- }
- }`,
- token
- );
- return res;
- }
-
- async function GetProductNaked(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { categories: "naked" }) {
- id
- name
- price
- img {
- url
- }
- }
- }`,
- token
- );
- return res;
- }
-
- async function GetProductSport(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { categories: "sport" }) {
- id
- name
- price
- img {
- url
- }
- }
- }`,
- token
- );
- return res;
- }
-
- async function GetProductOffRoad(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { categories: "offroad" }) {
- id
- name
- price
- img {
- url
- }
- }
- }`,
- token
- );
- return res;
- }
-
- async function GetProductMoped(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { categories: "moped" }) {
- id
- name
- price
- img {
- url
- }
- }
- }`,
- token
- );
- return res;
- }
-
- async function GetProductMonsterEnergy(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { categories: "monsterenergy" }) {
- id
- name
- price
- img {
- url
- }
- }
- }`,
- token
- );
- return res;
- }
-
- async function GetProductCBU(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { categories: "cbu" }) {
- id
- name
- price
- img {
- url
- }
- }
- }`,
- token
- );
- return res;
- }
-
- async function GetProductATV(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { categories: "atv" }) {
- id
- name
- price
- img {
- url
- }
- }
- }`,
- token
- );
- return res;
- }
-
- async function GetProductPowerProduct(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { categories: "powerproduct" }) {
- id
- name
- price
- img {
- url
- }
- }
- }`,
- token
- );
- return res;
- }
-
- async function GetProductSuzuki(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { business_partner: "2" }) {
- id
- name
- price
- img {
- url
- }
- }
- }`,
- token
- );
- return res;
- }
-
- async function GetProductHonda(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { business_partner: "3" }) {
- id
- name
- price
- img {
- url
- }
- }
- }`,
- token
- );
- return res;
- }
-
- module.exports = {
- //yamaha
- GetProductMatic: GetProductMatic,
- GetProductMaxi: GetProductMaxi,
- GetProductNaked: GetProductNaked,
- GetProductSport: GetProductSport,
- GetProductOffRoad: GetProductOffRoad,
- GetProductMoped: GetProductMoped,
- GetProductMonsterEnergy: GetProductMonsterEnergy,
- GetProductCBU: GetProductCBU,
- GetProductATV: GetProductATV,
- GetProductPowerProduct: GetProductPowerProduct,
-
- //suzuki
- GetProductSuzuki:GetProductSuzuki,
-
- //honda
- GetProductHonda:GetProductHonda,
-
- //detail
- GetDetailProduct: GetDetailProduct,
- };
|