選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

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