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

82 行
1.6 KiB

  1. import apollo from "../../../lib/apollo";
  2. async function dealersByCompanyId(id){
  3. var res = await apollo.query(
  4. `
  5. query($input : ID!){
  6. dealers(filters:{Company:{id:{eq:$input}}}){
  7. data{
  8. attributes{
  9. Address
  10. Name
  11. Telp
  12. Email
  13. Kota
  14. Gmap
  15. Image{
  16. data{
  17. attributes{
  18. url
  19. }
  20. }
  21. }
  22. Region{
  23. data{
  24. attributes{
  25. Name
  26. }
  27. }
  28. }
  29. }
  30. }
  31. }
  32. }`,'',{
  33. input:id
  34. }
  35. );
  36. return res;
  37. }
  38. async function dealersByCompanyName(name){
  39. var res = await apollo.query(
  40. `
  41. query($input : String!){
  42. dealers(filters:{Company:{Name:{eq:$input}}}){
  43. data{
  44. attributes{
  45. Address
  46. Name
  47. Telp
  48. Email
  49. Kota
  50. Gmap
  51. Image{
  52. data{
  53. attributes{
  54. url
  55. }
  56. }
  57. }
  58. Region{
  59. data{
  60. attributes{
  61. Name
  62. }
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }`,'',{
  69. "input":name
  70. }
  71. );
  72. return res;
  73. }
  74. module.exports = {
  75. dealersByCompanyId:dealersByCompanyId,
  76. dealersByCompanyName:dealersByCompanyName,
  77. };