Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 

256 lignes
3.8 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(token="") {
  29. var res = await apollo.query(
  30. `
  31. query{
  32. products
  33. {
  34. name
  35. price
  36. description
  37. img{
  38. url
  39. }
  40. business_partner
  41. {
  42. name
  43. }
  44. }
  45. } `,
  46. token
  47. );
  48. return res;
  49. }
  50. async function GetProductYamaha(token="") {
  51. var res = await apollo.query(
  52. `
  53. query {
  54. products(where: {business_partner: "1"})
  55. {
  56. id
  57. name
  58. description
  59. price
  60. img{
  61. url
  62. }
  63. business_partner
  64. {
  65. name
  66. }
  67. }
  68. }`,
  69. token
  70. );
  71. return res;
  72. }
  73. async function GetProductSuzuki(token="") {
  74. var res = await apollo.query(
  75. `
  76. query {
  77. products(where: {business_partner: "2"})
  78. {
  79. id
  80. name
  81. description
  82. price
  83. img{
  84. url
  85. }
  86. business_partner
  87. {
  88. name
  89. }
  90. }
  91. }`,
  92. token
  93. );
  94. return res;
  95. }
  96. async function GetProductHonda(token="") {
  97. var res = await apollo.query(
  98. `
  99. query {
  100. products(where: {business_partner: "3"})
  101. {
  102. id
  103. name
  104. description
  105. price
  106. img{
  107. url
  108. }
  109. business_partner
  110. {
  111. name
  112. }
  113. }
  114. }`,
  115. token
  116. );
  117. return res;
  118. }
  119. async function GetProductHino(token="") {
  120. var res = await apollo.query(
  121. `
  122. query {
  123. products(where: {business_partner: "4"})
  124. {
  125. id
  126. name
  127. description
  128. price
  129. img{
  130. url
  131. }
  132. business_partner
  133. {
  134. name
  135. }
  136. }
  137. }`,
  138. token
  139. );
  140. return res;
  141. }
  142. async function GetProductMercedes(token="") {
  143. var res = await apollo.query(
  144. `
  145. query {
  146. products(where: {business_partner: "5"})
  147. {
  148. id
  149. name
  150. description
  151. price
  152. img{
  153. url
  154. }
  155. business_partner
  156. {
  157. name
  158. }
  159. }
  160. }`,
  161. token
  162. );
  163. return res;
  164. }
  165. async function GetProductBPR(token="") {
  166. var res = await apollo.query(
  167. `
  168. query {
  169. products(where: {business_partner: "6"})
  170. {
  171. id
  172. name
  173. description
  174. price
  175. img{
  176. url
  177. }
  178. business_partner
  179. {
  180. name
  181. }
  182. }
  183. }`,
  184. token
  185. );
  186. return res;
  187. }
  188. async function GetProductEmilia(token="") {
  189. var res = await apollo.query(
  190. `
  191. query {
  192. products(where: {business_partner: "8"})
  193. {
  194. id
  195. name
  196. description
  197. price
  198. img{
  199. url
  200. }
  201. business_partner
  202. {
  203. name
  204. }
  205. }
  206. }`,
  207. token
  208. );
  209. return res;
  210. }
  211. async function GetProductHomes(token="") {
  212. var res = await apollo.query(
  213. `
  214. query {
  215. products(where: {business_partner: "9"})
  216. {
  217. id
  218. name
  219. description
  220. price
  221. img{
  222. url
  223. }
  224. business_partner
  225. {
  226. name
  227. }
  228. }
  229. }`,
  230. token
  231. );
  232. return res;
  233. }
  234. module.exports = {
  235. // GetProduct: GetProduct,
  236. GetDetailProduct:GetDetailProduct,
  237. GetProductYamaha:GetProductYamaha,
  238. GetProductSuzuki:GetProductSuzuki,
  239. GetProductHonda:GetProductHonda,
  240. GetProductHino:GetProductHino,
  241. GetProductMercedes:GetProductMercedes,
  242. GetProductBPR:GetProductBPR,
  243. GetProductEmilia:GetProductEmilia,
  244. GetProductHomes:GetProductHomes,
  245. };