選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

265 行
4.1 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. name
  9. price
  10. description
  11. img{
  12. url
  13. }
  14. overview
  15. specification
  16. film
  17. stock
  18. }
  19. } `,
  20. token, {
  21. "input": id
  22. }
  23. );
  24. return res;
  25. }
  26. async function GetProductMatic(token = "") {
  27. var res = await apollo.query(
  28. `
  29. query {
  30. products(where: { categories: "matic" }) {
  31. id
  32. name
  33. price
  34. img {
  35. url
  36. }
  37. }
  38. }`,
  39. token
  40. );
  41. return res;
  42. }
  43. async function GetProductMaxi(token = "") {
  44. var res = await apollo.query(
  45. `
  46. query {
  47. products(where: { categories: "maxi" }) {
  48. id
  49. name
  50. price
  51. img {
  52. url
  53. }
  54. }
  55. }`,
  56. token
  57. );
  58. return res;
  59. }
  60. async function GetProductNaked(token = "") {
  61. var res = await apollo.query(
  62. `
  63. query {
  64. products(where: { categories: "naked" }) {
  65. id
  66. name
  67. price
  68. img {
  69. url
  70. }
  71. }
  72. }`,
  73. token
  74. );
  75. return res;
  76. }
  77. async function GetProductSport(token = "") {
  78. var res = await apollo.query(
  79. `
  80. query {
  81. products(where: { categories: "sport" }) {
  82. id
  83. name
  84. price
  85. img {
  86. url
  87. }
  88. }
  89. }`,
  90. token
  91. );
  92. return res;
  93. }
  94. async function GetProductOffRoad(token = "") {
  95. var res = await apollo.query(
  96. `
  97. query {
  98. products(where: { categories: "offroad" }) {
  99. id
  100. name
  101. price
  102. img {
  103. url
  104. }
  105. }
  106. }`,
  107. token
  108. );
  109. return res;
  110. }
  111. async function GetProductMoped(token = "") {
  112. var res = await apollo.query(
  113. `
  114. query {
  115. products(where: { categories: "moped" }) {
  116. id
  117. name
  118. price
  119. img {
  120. url
  121. }
  122. }
  123. }`,
  124. token
  125. );
  126. return res;
  127. }
  128. async function GetProductMonsterEnergy(token = "") {
  129. var res = await apollo.query(
  130. `
  131. query {
  132. products(where: { categories: "monsterenergy" }) {
  133. id
  134. name
  135. price
  136. img {
  137. url
  138. }
  139. }
  140. }`,
  141. token
  142. );
  143. return res;
  144. }
  145. async function GetProductCBU(token = "") {
  146. var res = await apollo.query(
  147. `
  148. query {
  149. products(where: { categories: "cbu" }) {
  150. id
  151. name
  152. price
  153. img {
  154. url
  155. }
  156. }
  157. }`,
  158. token
  159. );
  160. return res;
  161. }
  162. async function GetProductATV(token = "") {
  163. var res = await apollo.query(
  164. `
  165. query {
  166. products(where: { categories: "atv" }) {
  167. id
  168. name
  169. price
  170. img {
  171. url
  172. }
  173. }
  174. }`,
  175. token
  176. );
  177. return res;
  178. }
  179. async function GetProductPowerProduct(token = "") {
  180. var res = await apollo.query(
  181. `
  182. query {
  183. products(where: { categories: "powerproduct" }) {
  184. id
  185. name
  186. price
  187. img {
  188. url
  189. }
  190. }
  191. }`,
  192. token
  193. );
  194. return res;
  195. }
  196. async function GetProductSuzuki(token = "") {
  197. var res = await apollo.query(
  198. `
  199. query {
  200. products(where: { business_partner: "2" }) {
  201. id
  202. name
  203. price
  204. img {
  205. url
  206. }
  207. }
  208. }`,
  209. token
  210. );
  211. return res;
  212. }
  213. async function GetProductHonda(token = "") {
  214. var res = await apollo.query(
  215. `
  216. query {
  217. products(where: { business_partner: "3" }) {
  218. id
  219. name
  220. price
  221. img {
  222. url
  223. }
  224. }
  225. }`,
  226. token
  227. );
  228. return res;
  229. }
  230. module.exports = {
  231. //yamaha
  232. GetProductMatic: GetProductMatic,
  233. GetProductMaxi: GetProductMaxi,
  234. GetProductNaked: GetProductNaked,
  235. GetProductSport: GetProductSport,
  236. GetProductOffRoad: GetProductOffRoad,
  237. GetProductMoped: GetProductMoped,
  238. GetProductMonsterEnergy: GetProductMonsterEnergy,
  239. GetProductCBU: GetProductCBU,
  240. GetProductATV: GetProductATV,
  241. GetProductPowerProduct: GetProductPowerProduct,
  242. //suzuki
  243. GetProductSuzuki:GetProductSuzuki,
  244. //honda
  245. GetProductHonda:GetProductHonda,
  246. //detail
  247. GetDetailProduct: GetDetailProduct,
  248. };