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.
 
 

295 lines
4.5 KiB

  1. import apollo from "../../lib/apollo.js";
  2. // async function GetProduct(token="", start = 0) {
  3. // var res = await apollo.query(
  4. // `
  5. // query($start: Int!) {
  6. // products(limit:1,start:$start)
  7. // {
  8. // id
  9. // name
  10. // price
  11. // description
  12. // img{
  13. // url
  14. // }
  15. // business_partner
  16. // {
  17. // name
  18. // }
  19. // }
  20. // }`,
  21. // token,
  22. // {
  23. // start: start,
  24. // }
  25. // );
  26. // return res;
  27. // }
  28. async function GetDetailProduct(id, token="") {
  29. var res = await apollo.query(
  30. `
  31. query($input: ID!){
  32. products(where:{id:$input})
  33. {
  34. name
  35. price
  36. description
  37. img{
  38. url
  39. }
  40. business_partner
  41. {
  42. name
  43. }
  44. overview
  45. specification
  46. film
  47. stock
  48. }
  49. } `,
  50. token,
  51. {
  52. "input": id
  53. }
  54. );
  55. return res;
  56. }
  57. async function GetProductYamaha(token="") {
  58. var res = await apollo.query(
  59. `
  60. query {
  61. products(where: {business_partner: "1"})
  62. {
  63. id
  64. name
  65. description
  66. price
  67. img{
  68. url
  69. }
  70. business_partner
  71. {
  72. name
  73. }
  74. overview
  75. specification
  76. film
  77. stock
  78. }
  79. }`,
  80. token
  81. );
  82. return res;
  83. }
  84. async function GetProductSuzuki(token="") {
  85. var res = await apollo.query(
  86. `
  87. query {
  88. products(where: {business_partner: "2"})
  89. {
  90. id
  91. name
  92. description
  93. price
  94. img{
  95. url
  96. }
  97. business_partner
  98. {
  99. name
  100. }
  101. overview
  102. specification
  103. film
  104. stock
  105. }
  106. }`,
  107. token
  108. );
  109. return res;
  110. }
  111. async function GetProductHonda(token="") {
  112. var res = await apollo.query(
  113. `
  114. query {
  115. products(where: {business_partner: "3"})
  116. {
  117. id
  118. name
  119. description
  120. price
  121. img{
  122. url
  123. }
  124. business_partner
  125. {
  126. name
  127. }
  128. overview
  129. specification
  130. film
  131. stock
  132. }
  133. }`,
  134. token
  135. );
  136. return res;
  137. }
  138. async function GetProductHino(token="") {
  139. var res = await apollo.query(
  140. `
  141. query {
  142. products(where: {business_partner: "4"})
  143. {
  144. id
  145. name
  146. description
  147. price
  148. img{
  149. url
  150. }
  151. business_partner
  152. {
  153. name
  154. }
  155. overview
  156. specification
  157. film
  158. stock
  159. }
  160. }`,
  161. token
  162. );
  163. return res;
  164. }
  165. async function GetProductMercedes(token="") {
  166. var res = await apollo.query(
  167. `
  168. query {
  169. products(where: {business_partner: "5"})
  170. {
  171. id
  172. name
  173. description
  174. price
  175. img{
  176. url
  177. }
  178. business_partner
  179. {
  180. name
  181. }
  182. overview
  183. specification
  184. film
  185. stock
  186. }
  187. }`,
  188. token
  189. );
  190. return res;
  191. }
  192. async function GetProductBPR(token="") {
  193. var res = await apollo.query(
  194. `
  195. query {
  196. products(where: {business_partner: "6"})
  197. {
  198. id
  199. name
  200. description
  201. price
  202. img{
  203. url
  204. }
  205. business_partner
  206. {
  207. name
  208. }
  209. overview
  210. specification
  211. film
  212. stock
  213. }
  214. }`,
  215. token
  216. );
  217. return res;
  218. }
  219. async function GetProductEmilia(token="") {
  220. var res = await apollo.query(
  221. `
  222. query {
  223. products(where: {business_partner: "8"})
  224. {
  225. id
  226. name
  227. description
  228. price
  229. img{
  230. url
  231. }
  232. business_partner
  233. {
  234. name
  235. }
  236. overview
  237. specification
  238. film
  239. stock
  240. }
  241. }`,
  242. token
  243. );
  244. return res;
  245. }
  246. async function GetProductHomes(token="") {
  247. var res = await apollo.query(
  248. `
  249. query {
  250. products(where: {business_partner: "9"})
  251. {
  252. id
  253. name
  254. description
  255. price
  256. img{
  257. url
  258. }
  259. business_partner
  260. {
  261. name
  262. }
  263. overview
  264. specification
  265. film
  266. stock
  267. }
  268. }`,
  269. token
  270. );
  271. return res;
  272. }
  273. module.exports = {
  274. // GetProduct: GetProduct,
  275. GetDetailProduct:GetDetailProduct,
  276. GetProductYamaha:GetProductYamaha,
  277. GetProductSuzuki:GetProductSuzuki,
  278. GetProductHonda:GetProductHonda,
  279. GetProductHino:GetProductHino,
  280. GetProductMercedes:GetProductMercedes,
  281. GetProductBPR:GetProductBPR,
  282. GetProductEmilia:GetProductEmilia,
  283. GetProductHomes:GetProductHomes,
  284. };