the bola v2 website
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

API.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. const server_url = "https://thebola.club";
  2. export default class API {
  3. constructor() {
  4. this.prefix = server_url;
  5. this.url = "/api";
  6. this.test = 200;
  7. }
  8. listState({_callback = () => {}}){
  9. const url = `${this.prefix}${this.url}/public/event/location/state`
  10. fetch(url)
  11. .then(response => response.json())
  12. .then(data => _callback(data))
  13. .catch(err => console.log(err))
  14. }
  15. listLocation({ state, city, _callback = () => {}}) {
  16. const url = `${this.prefix}${this.url}/public/event/location/field?` + new URLSearchParams({
  17. state, city
  18. })
  19. fetch(url)
  20. .then(response => response.json())
  21. .then(data => _callback(data) )
  22. .catch(err => console.log(err))
  23. }
  24. listField({state, city, field_name, _callback = () => {}}){
  25. const url = `${this.prefix}${this.url}/public/event/location?` + new URLSearchParams({
  26. state, city, field_name
  27. })
  28. fetch(url)
  29. .then(response => response.json())
  30. .then(data => _callback(data) )
  31. .catch(err => console.log(err))
  32. }
  33. enquiry({ email, name, message }, _callback){
  34. let url = `${this.prefix}${this.url}/public/enquiry`;
  35. fetch(url,{
  36. method: "POST",
  37. headers: {
  38. 'Content-Type': 'application/json;charset=utf-8',
  39. },
  40. body: JSON.stringify({
  41. contact_email: email,
  42. contact_name: name,
  43. message
  44. })
  45. } )
  46. .then(response => response.json())
  47. .then(data => _callback(data) )
  48. .catch(err => console.log(err))
  49. }
  50. }