Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

361 Zeilen
5.6 KiB

  1. import apollo from "../../lib/apollo.js";
  2. async function GetDetailProduct(id, token = "") {
  3. var res = await apollo.query(
  4. `
  5. query($input: ID!){
  6. products(where:{id:$input})
  7. {
  8. id
  9. name
  10. price
  11. price1
  12. price2
  13. product_otrs {
  14. id
  15. name
  16. price
  17. }
  18. description
  19. spesifikasi_mesin
  20. spesifikasi_dimensi
  21. spesifikasi_rangka
  22. spesifikasi_kelistrikan
  23. film
  24. stock
  25. img{
  26. url
  27. }
  28. overview1
  29. img_overview1{
  30. url
  31. }
  32. overview2
  33. img_overview2{
  34. url
  35. }
  36. overview3
  37. img_overview3{
  38. url
  39. }
  40. overview4
  41. img_overview4{
  42. url
  43. }
  44. overview5
  45. img_overview5{
  46. url
  47. }
  48. overview6
  49. img_overview6{
  50. url
  51. }
  52. overview7
  53. img_overview7{
  54. url
  55. }
  56. overview8
  57. img_overview8{
  58. url
  59. }
  60. overview9
  61. img_overview9{
  62. url
  63. }
  64. overview10
  65. img_overview10{
  66. url
  67. }
  68. }
  69. } `,
  70. token, {
  71. "input": id
  72. }
  73. );
  74. return res;
  75. }
  76. async function GetProductImgColor(id, token = "") {
  77. var res = await apollo.query(
  78. `
  79. query($input: ID!) {
  80. productImageColors(where:{id:$input}) {
  81. id
  82. name
  83. img{
  84. url
  85. }
  86. }
  87. }
  88. `,
  89. token, {
  90. "input": id
  91. }
  92. );
  93. return res;
  94. }
  95. async function GetProduct(token = "") {
  96. var res = await apollo.query(
  97. `
  98. query {
  99. products{
  100. id
  101. name
  102. price
  103. price1
  104. price2
  105. img {
  106. url
  107. }
  108. }
  109. }`,
  110. token
  111. );
  112. return res;
  113. }
  114. async function GetProductMatic(token = "") {
  115. var res = await apollo.query(
  116. `
  117. query {
  118. products(where: { categories: "matic" }) {
  119. id
  120. name
  121. price
  122. img {
  123. url
  124. }
  125. }
  126. }`,
  127. token
  128. );
  129. return res;
  130. }
  131. async function GetProductMaxi(token = "") {
  132. var res = await apollo.query(
  133. `
  134. query {
  135. products(where: { categories: "maxi" }) {
  136. id
  137. name
  138. price
  139. img {
  140. url
  141. }
  142. }
  143. }`,
  144. token
  145. );
  146. return res;
  147. }
  148. async function GetProductNaked(token = "") {
  149. var res = await apollo.query(
  150. `
  151. query {
  152. products(where: { categories: "naked" }) {
  153. id
  154. name
  155. price
  156. img {
  157. url
  158. }
  159. }
  160. }`,
  161. token
  162. );
  163. return res;
  164. }
  165. async function GetProductSport(token = "") {
  166. var res = await apollo.query(
  167. `
  168. query {
  169. products(where: { categories: "sport" }) {
  170. id
  171. name
  172. price
  173. img {
  174. url
  175. }
  176. }
  177. }`,
  178. token
  179. );
  180. return res;
  181. }
  182. async function GetProductOffRoad(token = "") {
  183. var res = await apollo.query(
  184. `
  185. query {
  186. products(where: { categories: "offroad" }) {
  187. id
  188. name
  189. price
  190. img {
  191. url
  192. }
  193. }
  194. }`,
  195. token
  196. );
  197. return res;
  198. }
  199. async function GetProductMoped(token = "") {
  200. var res = await apollo.query(
  201. `
  202. query {
  203. products(where: { categories: "moped" }) {
  204. id
  205. name
  206. price
  207. img {
  208. url
  209. }
  210. }
  211. }`,
  212. token
  213. );
  214. return res;
  215. }
  216. async function GetProductMonsterEnergy(token = "") {
  217. var res = await apollo.query(
  218. `
  219. query {
  220. products(where: { categories: "monsterenergy" }) {
  221. id
  222. name
  223. price
  224. img {
  225. url
  226. }
  227. }
  228. }`,
  229. token
  230. );
  231. return res;
  232. }
  233. async function GetProductCBU(token = "") {
  234. var res = await apollo.query(
  235. `
  236. query {
  237. products(where: { categories: "cbu" }) {
  238. id
  239. name
  240. price
  241. img {
  242. url
  243. }
  244. }
  245. }`,
  246. token
  247. );
  248. return res;
  249. }
  250. async function GetProductATV(token = "") {
  251. var res = await apollo.query(
  252. `
  253. query {
  254. products(where: { categories: "atv" }) {
  255. id
  256. name
  257. price
  258. img {
  259. url
  260. }
  261. }
  262. }`,
  263. token
  264. );
  265. return res;
  266. }
  267. async function GetProductPowerProduct(token = "") {
  268. var res = await apollo.query(
  269. `
  270. query {
  271. products(where: { categories: "powerproduct" }) {
  272. id
  273. name
  274. price
  275. img {
  276. url
  277. }
  278. }
  279. }`,
  280. token
  281. );
  282. return res;
  283. }
  284. async function GetProductHonda(token = "") {
  285. var res = await apollo.query(
  286. `
  287. query {
  288. products(where: { business_partner: "3" }) {
  289. id
  290. name
  291. price
  292. img {
  293. url
  294. }
  295. }
  296. }`,
  297. token
  298. );
  299. return res;
  300. }
  301. async function GetProductHino(token = "") {
  302. var res = await apollo.query(
  303. `
  304. query {
  305. products(where: { business_partner: "4" }) {
  306. id
  307. name
  308. price
  309. img {
  310. url
  311. }
  312. }
  313. }`,
  314. token
  315. );
  316. return res;
  317. }
  318. module.exports = {
  319. GetProductImgColor: GetProductImgColor,
  320. GetProduct: GetProduct,
  321. //yamaha
  322. GetProductMatic: GetProductMatic,
  323. GetProductMaxi: GetProductMaxi,
  324. GetProductNaked: GetProductNaked,
  325. GetProductSport: GetProductSport,
  326. GetProductOffRoad: GetProductOffRoad,
  327. GetProductMoped: GetProductMoped,
  328. GetProductMonsterEnergy: GetProductMonsterEnergy,
  329. GetProductCBU: GetProductCBU,
  330. GetProductATV: GetProductATV,
  331. GetProductPowerProduct: GetProductPowerProduct,
  332. //honda
  333. GetProductHonda:GetProductHonda,
  334. //hino
  335. GetProductHino:GetProductHino,
  336. //detail
  337. GetDetailProduct: GetDetailProduct,
  338. };