Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 

359 rindas
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. img {
  104. url
  105. }
  106. }
  107. }`,
  108. token
  109. );
  110. return res;
  111. }
  112. async function GetProductMatic(token = "") {
  113. var res = await apollo.query(
  114. `
  115. query {
  116. products(where: { categories: "matic" }) {
  117. id
  118. name
  119. price
  120. img {
  121. url
  122. }
  123. }
  124. }`,
  125. token
  126. );
  127. return res;
  128. }
  129. async function GetProductMaxi(token = "") {
  130. var res = await apollo.query(
  131. `
  132. query {
  133. products(where: { categories: "maxi" }) {
  134. id
  135. name
  136. price
  137. img {
  138. url
  139. }
  140. }
  141. }`,
  142. token
  143. );
  144. return res;
  145. }
  146. async function GetProductNaked(token = "") {
  147. var res = await apollo.query(
  148. `
  149. query {
  150. products(where: { categories: "naked" }) {
  151. id
  152. name
  153. price
  154. img {
  155. url
  156. }
  157. }
  158. }`,
  159. token
  160. );
  161. return res;
  162. }
  163. async function GetProductSport(token = "") {
  164. var res = await apollo.query(
  165. `
  166. query {
  167. products(where: { categories: "sport" }) {
  168. id
  169. name
  170. price
  171. img {
  172. url
  173. }
  174. }
  175. }`,
  176. token
  177. );
  178. return res;
  179. }
  180. async function GetProductOffRoad(token = "") {
  181. var res = await apollo.query(
  182. `
  183. query {
  184. products(where: { categories: "offroad" }) {
  185. id
  186. name
  187. price
  188. img {
  189. url
  190. }
  191. }
  192. }`,
  193. token
  194. );
  195. return res;
  196. }
  197. async function GetProductMoped(token = "") {
  198. var res = await apollo.query(
  199. `
  200. query {
  201. products(where: { categories: "moped" }) {
  202. id
  203. name
  204. price
  205. img {
  206. url
  207. }
  208. }
  209. }`,
  210. token
  211. );
  212. return res;
  213. }
  214. async function GetProductMonsterEnergy(token = "") {
  215. var res = await apollo.query(
  216. `
  217. query {
  218. products(where: { categories: "monsterenergy" }) {
  219. id
  220. name
  221. price
  222. img {
  223. url
  224. }
  225. }
  226. }`,
  227. token
  228. );
  229. return res;
  230. }
  231. async function GetProductCBU(token = "") {
  232. var res = await apollo.query(
  233. `
  234. query {
  235. products(where: { categories: "cbu" }) {
  236. id
  237. name
  238. price
  239. img {
  240. url
  241. }
  242. }
  243. }`,
  244. token
  245. );
  246. return res;
  247. }
  248. async function GetProductATV(token = "") {
  249. var res = await apollo.query(
  250. `
  251. query {
  252. products(where: { categories: "atv" }) {
  253. id
  254. name
  255. price
  256. img {
  257. url
  258. }
  259. }
  260. }`,
  261. token
  262. );
  263. return res;
  264. }
  265. async function GetProductPowerProduct(token = "") {
  266. var res = await apollo.query(
  267. `
  268. query {
  269. products(where: { categories: "powerproduct" }) {
  270. id
  271. name
  272. price
  273. img {
  274. url
  275. }
  276. }
  277. }`,
  278. token
  279. );
  280. return res;
  281. }
  282. async function GetProductHonda(token = "") {
  283. var res = await apollo.query(
  284. `
  285. query {
  286. products(where: { business_partner: "3" }) {
  287. id
  288. name
  289. price
  290. img {
  291. url
  292. }
  293. }
  294. }`,
  295. token
  296. );
  297. return res;
  298. }
  299. async function GetProductHino(token = "") {
  300. var res = await apollo.query(
  301. `
  302. query {
  303. products(where: { business_partner: "4" }) {
  304. id
  305. name
  306. price
  307. img {
  308. url
  309. }
  310. }
  311. }`,
  312. token
  313. );
  314. return res;
  315. }
  316. module.exports = {
  317. GetProductImgColor: GetProductImgColor,
  318. GetProduct: GetProduct,
  319. //yamaha
  320. GetProductMatic: GetProductMatic,
  321. GetProductMaxi: GetProductMaxi,
  322. GetProductNaked: GetProductNaked,
  323. GetProductSport: GetProductSport,
  324. GetProductOffRoad: GetProductOffRoad,
  325. GetProductMoped: GetProductMoped,
  326. GetProductMonsterEnergy: GetProductMonsterEnergy,
  327. GetProductCBU: GetProductCBU,
  328. GetProductATV: GetProductATV,
  329. GetProductPowerProduct: GetProductPowerProduct,
  330. //honda
  331. GetProductHonda:GetProductHonda,
  332. //hino
  333. GetProductHino:GetProductHino,
  334. //detail
  335. GetDetailProduct: GetDetailProduct,
  336. };