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.
 
 

250 rader
4.3 KiB

  1. import apollo from "../../lib/apollo.js";
  2. async function GetSparepartYGP(token="") {
  3. var res = await apollo.query(
  4. `
  5. query{
  6. ygParts{
  7. id
  8. name
  9. img{
  10. url
  11. }
  12. price1
  13. price2
  14. ygp_units{
  15. name
  16. part_code
  17. price
  18. }
  19. }
  20. }
  21. `,
  22. token
  23. );
  24. return res;
  25. }
  26. async function GetSparepartYamalube(token="") {
  27. var res = await apollo.query(
  28. `
  29. query {
  30. yamalubes {
  31. id
  32. name
  33. part_code
  34. price
  35. description
  36. stock
  37. img{
  38. url
  39. }
  40. }
  41. }
  42. `,
  43. token
  44. );
  45. return res;
  46. }
  47. async function GetHelmet(token="") {
  48. var res = await apollo.query(
  49. `
  50. query {
  51. helmets{
  52. id
  53. name
  54. price
  55. img {
  56. url
  57. }
  58. }
  59. }`,
  60. token
  61. );
  62. return res;
  63. }
  64. async function GetApparel(token="") {
  65. var res = await apollo.query(
  66. `
  67. query {
  68. apparels{
  69. id
  70. name
  71. price
  72. img {
  73. url
  74. }
  75. }
  76. }`,
  77. token
  78. );
  79. return res;
  80. }
  81. async function GetAcc(token="") {
  82. var res = await apollo.query(
  83. `
  84. query {
  85. accessories{
  86. id
  87. name
  88. price
  89. img {
  90. url
  91. }
  92. }
  93. }`,
  94. token
  95. );
  96. return res;
  97. }
  98. async function GetYGPDetail(id, token="") {
  99. var res = await apollo.query(
  100. `
  101. query($input: ID!){
  102. ygParts(where:{id:$input})
  103. {
  104. id
  105. name
  106. img{
  107. url
  108. }
  109. description
  110. price1
  111. price2
  112. ygp_units{
  113. name
  114. part_code
  115. price
  116. description
  117. }
  118. }
  119. } `,
  120. token,
  121. {
  122. "input": id
  123. }
  124. );
  125. return res;
  126. }
  127. async function GetYamalubeDetail(id, token="") {
  128. var res = await apollo.query(
  129. `
  130. query($input: ID!){
  131. yamalubes(where:{id:$input})
  132. {
  133. id
  134. name
  135. description
  136. price
  137. part_code
  138. img {
  139. url
  140. }
  141. stock
  142. }
  143. } `,
  144. token,
  145. {
  146. "input": id
  147. }
  148. );
  149. return res;
  150. }
  151. async function GetHelmetDetail(id, token="") {
  152. var res = await apollo.query(
  153. `
  154. query($input: ID!){
  155. helmets(where:{id:$input})
  156. {
  157. id
  158. name
  159. description
  160. price
  161. part_code
  162. img {
  163. url
  164. }
  165. stock
  166. }
  167. } `,
  168. token,
  169. {
  170. "input": id
  171. }
  172. );
  173. return res;
  174. }
  175. async function GetApparelDetail(id, token="") {
  176. var res = await apollo.query(
  177. `
  178. query($input: ID!){
  179. apparels(where:{id:$input})
  180. {
  181. id
  182. name
  183. description
  184. price
  185. part_code
  186. img {
  187. url
  188. }
  189. stock
  190. }
  191. } `,
  192. token,
  193. {
  194. "input": id
  195. }
  196. );
  197. return res;
  198. }
  199. async function GetAccDetail(id, token="") {
  200. var res = await apollo.query(
  201. `
  202. query($input: ID!){
  203. accessories(where:{id:$input})
  204. {
  205. id
  206. name
  207. description
  208. price
  209. part_code
  210. img {
  211. url
  212. }
  213. stock
  214. }
  215. } `,
  216. token,
  217. {
  218. "input": id
  219. }
  220. );
  221. return res;
  222. }
  223. module.exports = {
  224. //collection type YGP
  225. GetSparepartYGP: GetSparepartYGP,
  226. GetSparepartYamalube: GetSparepartYamalube,
  227. GetHelmet: GetHelmet,
  228. GetApparel: GetApparel,
  229. GetAcc: GetAcc,
  230. //Detail
  231. GetYGPDetail: GetYGPDetail,
  232. GetYamalubeDetail: GetYamalubeDetail,
  233. GetHelmetDetail: GetHelmetDetail,
  234. GetApparelDetail: GetApparelDetail,
  235. GetAccDetail: GetAccDetail,
  236. };