|
- import apollo from "../../lib/apollo.js";
-
- async function GetDetailProduct(id, token = "") {
- var res = await apollo.query(
- `
- query($input: ID!){
- products(where:{id:$input})
- {
- id
- name
- price
- description
- spesifikasi_mesin
- spesifikasi_dimensi
- spesifikasi_rangka
- spesifikasi_kelistrikan
- film
- stock
- img{
- url
- }
- overview1
- img_overview1{
- url
- }
- overview2
- img_overview2{
- url
- }
- overview3
- img_overview3{
- url
- }
- overview4
- img_overview4{
- url
- }
- overview5
- img_overview5{
- url
- }
- overview6
- img_overview6{
- url
- }
- overview7
- img_overview7{
- url
- }
- overview8
- img_overview8{
- url
- }
- overview9
- img_overview9{
- url
- }
- overview10
- img_overview10{
- url
- }
- }
- } `,
- 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;
- }
-
- async function GetProductHino(token = "") {
- var res = await apollo.query(
- `
- query {
- products(where: { business_partner: "4" }) {
- 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,
-
- //hino
- GetProductHino:GetProductHino,
-
- //detail
- GetDetailProduct: GetDetailProduct,
- };
|