You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

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