Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

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