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

95 行
1.4 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. price1
  12. price2
  13. discount
  14. img{
  15. url
  16. }
  17. product_otrs {
  18. id
  19. name
  20. price
  21. }
  22. product_image_colors{
  23. id
  24. name
  25. img{
  26. url
  27. }
  28. }
  29. description
  30. spesifikasi_mesin
  31. spesifikasi_dimensi
  32. spesifikasi_rangka
  33. spesifikasi_kelistrikan
  34. film
  35. stock
  36. }
  37. } `,
  38. token, {
  39. "input": id
  40. }
  41. );
  42. return res;
  43. }
  44. async function GetProductImgColor(id, token = "") {
  45. var res = await apollo.query(
  46. `
  47. query($input: ID!) {
  48. productImageColors(where:{id:$input}) {
  49. id
  50. name
  51. img{
  52. url
  53. }
  54. }
  55. }
  56. `,
  57. token, {
  58. "input": id
  59. }
  60. );
  61. return res;
  62. }
  63. async function GetProduct(token = "") {
  64. var res = await apollo.query(
  65. `
  66. query {
  67. products{
  68. id
  69. name
  70. price
  71. price1
  72. price2
  73. discount
  74. img {
  75. url
  76. }
  77. }
  78. }`,
  79. token
  80. );
  81. return res;
  82. }
  83. module.exports = {
  84. GetProductImgColor: GetProductImgColor,
  85. GetProduct: GetProduct,
  86. //detail
  87. GetDetailProduct: GetDetailProduct,
  88. };