您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

329 行
5.2 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. id
  9. name
  10. price
  11. description
  12. spesifikasi_mesin
  13. spesifikasi_dimensi
  14. spesifikasi_rangka
  15. spesifikasi_kelistrikan
  16. film
  17. stock
  18. img{
  19. url
  20. }
  21. overview1
  22. img_overview1{
  23. url
  24. }
  25. overview2
  26. img_overview2{
  27. url
  28. }
  29. overview3
  30. img_overview3{
  31. url
  32. }
  33. overview4
  34. img_overview4{
  35. url
  36. }
  37. overview5
  38. img_overview5{
  39. url
  40. }
  41. overview6
  42. img_overview6{
  43. url
  44. }
  45. overview7
  46. img_overview7{
  47. url
  48. }
  49. overview8
  50. img_overview8{
  51. url
  52. }
  53. overview9
  54. img_overview9{
  55. url
  56. }
  57. overview10
  58. img_overview10{
  59. url
  60. }
  61. }
  62. } `,
  63. token, {
  64. "input": id
  65. }
  66. );
  67. return res;
  68. }
  69. async function GetProductMatic(token = "") {
  70. var res = await apollo.query(
  71. `
  72. query {
  73. products(where: { categories: "matic" }) {
  74. id
  75. name
  76. price
  77. img {
  78. url
  79. }
  80. }
  81. }`,
  82. token
  83. );
  84. return res;
  85. }
  86. async function GetProductMaxi(token = "") {
  87. var res = await apollo.query(
  88. `
  89. query {
  90. products(where: { categories: "maxi" }) {
  91. id
  92. name
  93. price
  94. img {
  95. url
  96. }
  97. }
  98. }`,
  99. token
  100. );
  101. return res;
  102. }
  103. async function GetProductNaked(token = "") {
  104. var res = await apollo.query(
  105. `
  106. query {
  107. products(where: { categories: "naked" }) {
  108. id
  109. name
  110. price
  111. img {
  112. url
  113. }
  114. }
  115. }`,
  116. token
  117. );
  118. return res;
  119. }
  120. async function GetProductSport(token = "") {
  121. var res = await apollo.query(
  122. `
  123. query {
  124. products(where: { categories: "sport" }) {
  125. id
  126. name
  127. price
  128. img {
  129. url
  130. }
  131. }
  132. }`,
  133. token
  134. );
  135. return res;
  136. }
  137. async function GetProductOffRoad(token = "") {
  138. var res = await apollo.query(
  139. `
  140. query {
  141. products(where: { categories: "offroad" }) {
  142. id
  143. name
  144. price
  145. img {
  146. url
  147. }
  148. }
  149. }`,
  150. token
  151. );
  152. return res;
  153. }
  154. async function GetProductMoped(token = "") {
  155. var res = await apollo.query(
  156. `
  157. query {
  158. products(where: { categories: "moped" }) {
  159. id
  160. name
  161. price
  162. img {
  163. url
  164. }
  165. }
  166. }`,
  167. token
  168. );
  169. return res;
  170. }
  171. async function GetProductMonsterEnergy(token = "") {
  172. var res = await apollo.query(
  173. `
  174. query {
  175. products(where: { categories: "monsterenergy" }) {
  176. id
  177. name
  178. price
  179. img {
  180. url
  181. }
  182. }
  183. }`,
  184. token
  185. );
  186. return res;
  187. }
  188. async function GetProductCBU(token = "") {
  189. var res = await apollo.query(
  190. `
  191. query {
  192. products(where: { categories: "cbu" }) {
  193. id
  194. name
  195. price
  196. img {
  197. url
  198. }
  199. }
  200. }`,
  201. token
  202. );
  203. return res;
  204. }
  205. async function GetProductATV(token = "") {
  206. var res = await apollo.query(
  207. `
  208. query {
  209. products(where: { categories: "atv" }) {
  210. id
  211. name
  212. price
  213. img {
  214. url
  215. }
  216. }
  217. }`,
  218. token
  219. );
  220. return res;
  221. }
  222. async function GetProductPowerProduct(token = "") {
  223. var res = await apollo.query(
  224. `
  225. query {
  226. products(where: { categories: "powerproduct" }) {
  227. id
  228. name
  229. price
  230. img {
  231. url
  232. }
  233. }
  234. }`,
  235. token
  236. );
  237. return res;
  238. }
  239. async function GetProductSuzuki(token = "") {
  240. var res = await apollo.query(
  241. `
  242. query {
  243. products(where: { business_partner: "2" }) {
  244. id
  245. name
  246. price
  247. img {
  248. url
  249. }
  250. }
  251. }`,
  252. token
  253. );
  254. return res;
  255. }
  256. async function GetProductHonda(token = "") {
  257. var res = await apollo.query(
  258. `
  259. query {
  260. products(where: { business_partner: "3" }) {
  261. id
  262. name
  263. price
  264. img {
  265. url
  266. }
  267. }
  268. }`,
  269. token
  270. );
  271. return res;
  272. }
  273. async function GetProductHino(token = "") {
  274. var res = await apollo.query(
  275. `
  276. query {
  277. products(where: { business_partner: "4" }) {
  278. id
  279. name
  280. price
  281. img {
  282. url
  283. }
  284. }
  285. }`,
  286. token
  287. );
  288. return res;
  289. }
  290. module.exports = {
  291. //yamaha
  292. GetProductMatic: GetProductMatic,
  293. GetProductMaxi: GetProductMaxi,
  294. GetProductNaked: GetProductNaked,
  295. GetProductSport: GetProductSport,
  296. GetProductOffRoad: GetProductOffRoad,
  297. GetProductMoped: GetProductMoped,
  298. GetProductMonsterEnergy: GetProductMonsterEnergy,
  299. GetProductCBU: GetProductCBU,
  300. GetProductATV: GetProductATV,
  301. GetProductPowerProduct: GetProductPowerProduct,
  302. //suzuki
  303. GetProductSuzuki:GetProductSuzuki,
  304. //honda
  305. GetProductHonda:GetProductHonda,
  306. //hino
  307. GetProductHino:GetProductHino,
  308. //detail
  309. GetDetailProduct: GetDetailProduct,
  310. };