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.
 
 

313 lignes
4.7 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. url
  48. }
  49. stock
  50. }
  51. } `,
  52. token,
  53. {
  54. "input": id
  55. }
  56. );
  57. return res;
  58. }
  59. async function GetProductYamaha(token="") {
  60. var res = await apollo.query(
  61. `
  62. query {
  63. products(where: {business_partner: "1"})
  64. {
  65. id
  66. name
  67. description
  68. price
  69. img{
  70. url
  71. }
  72. business_partner
  73. {
  74. name
  75. }
  76. overview
  77. specification
  78. film{
  79. url
  80. }
  81. stock
  82. }
  83. }`,
  84. token
  85. );
  86. return res;
  87. }
  88. async function GetProductSuzuki(token="") {
  89. var res = await apollo.query(
  90. `
  91. query {
  92. products(where: {business_partner: "2"})
  93. {
  94. id
  95. name
  96. description
  97. price
  98. img{
  99. url
  100. }
  101. business_partner
  102. {
  103. name
  104. }
  105. overview
  106. specification
  107. film{
  108. url
  109. }
  110. stock
  111. }
  112. }`,
  113. token
  114. );
  115. return res;
  116. }
  117. async function GetProductHonda(token="") {
  118. var res = await apollo.query(
  119. `
  120. query {
  121. products(where: {business_partner: "3"})
  122. {
  123. id
  124. name
  125. description
  126. price
  127. img{
  128. url
  129. }
  130. business_partner
  131. {
  132. name
  133. }
  134. overview
  135. specification
  136. film{
  137. url
  138. }
  139. stock
  140. }
  141. }`,
  142. token
  143. );
  144. return res;
  145. }
  146. async function GetProductHino(token="") {
  147. var res = await apollo.query(
  148. `
  149. query {
  150. products(where: {business_partner: "4"})
  151. {
  152. id
  153. name
  154. description
  155. price
  156. img{
  157. url
  158. }
  159. business_partner
  160. {
  161. name
  162. }
  163. overview
  164. specification
  165. film{
  166. url
  167. }
  168. stock
  169. }
  170. }`,
  171. token
  172. );
  173. return res;
  174. }
  175. async function GetProductMercedes(token="") {
  176. var res = await apollo.query(
  177. `
  178. query {
  179. products(where: {business_partner: "5"})
  180. {
  181. id
  182. name
  183. description
  184. price
  185. img{
  186. url
  187. }
  188. business_partner
  189. {
  190. name
  191. }
  192. overview
  193. specification
  194. film{
  195. url
  196. }
  197. stock
  198. }
  199. }`,
  200. token
  201. );
  202. return res;
  203. }
  204. async function GetProductBPR(token="") {
  205. var res = await apollo.query(
  206. `
  207. query {
  208. products(where: {business_partner: "6"})
  209. {
  210. id
  211. name
  212. description
  213. price
  214. img{
  215. url
  216. }
  217. business_partner
  218. {
  219. name
  220. }
  221. overview
  222. specification
  223. film{
  224. url
  225. }
  226. stock
  227. }
  228. }`,
  229. token
  230. );
  231. return res;
  232. }
  233. async function GetProductEmilia(token="") {
  234. var res = await apollo.query(
  235. `
  236. query {
  237. products(where: {business_partner: "8"})
  238. {
  239. id
  240. name
  241. description
  242. price
  243. img{
  244. url
  245. }
  246. business_partner
  247. {
  248. name
  249. }
  250. overview
  251. specification
  252. film{
  253. url
  254. }
  255. stock
  256. }
  257. }`,
  258. token
  259. );
  260. return res;
  261. }
  262. async function GetProductHomes(token="") {
  263. var res = await apollo.query(
  264. `
  265. query {
  266. products(where: {business_partner: "9"})
  267. {
  268. id
  269. name
  270. description
  271. price
  272. img{
  273. url
  274. }
  275. business_partner
  276. {
  277. name
  278. }
  279. overview
  280. specification
  281. film{
  282. url
  283. }
  284. stock
  285. }
  286. }`,
  287. token
  288. );
  289. return res;
  290. }
  291. module.exports = {
  292. // GetProduct: GetProduct,
  293. GetDetailProduct:GetDetailProduct,
  294. GetProductYamaha:GetProductYamaha,
  295. GetProductSuzuki:GetProductSuzuki,
  296. GetProductHonda:GetProductHonda,
  297. GetProductHino:GetProductHino,
  298. GetProductMercedes:GetProductMercedes,
  299. GetProductBPR:GetProductBPR,
  300. GetProductEmilia:GetProductEmilia,
  301. GetProductHomes:GetProductHomes,
  302. };