Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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