12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- const server_url = "https://thebola.club";
-
- export default class API {
- constructor() {
- this.prefix = server_url;
- this.url = "/api";
- this.test = 200;
- }
-
- listState({_callback = () => {}}){
- const url = `${this.prefix}${this.url}/public/event/location/state`
-
- fetch(url)
- .then(response => response.json())
- .then(data => _callback(data))
- .catch(err => console.log(err))
-
- }
-
- listLocation({ state, city, _callback = () => {}}) {
-
- const url = `${this.prefix}${this.url}/public/event/location/field?` + new URLSearchParams({
- state, city
- })
-
- fetch(url)
- .then(response => response.json())
- .then(data => _callback(data) )
- .catch(err => console.log(err))
- }
-
- listField({state, city, field_name, _callback = () => {}}){
-
- const url = `${this.prefix}${this.url}/public/event/location?` + new URLSearchParams({
- state, city, field_name
- })
-
- fetch(url)
- .then(response => response.json())
- .then(data => _callback(data) )
- .catch(err => console.log(err))
-
- }
-
- enquiry({ email, name, message }, _callback){
-
- let url = `${this.prefix}${this.url}/public/enquiry`;
-
- fetch(url,{
- method: "POST",
- headers: {
- 'Content-Type': 'application/json;charset=utf-8',
- },
- body: JSON.stringify({
- contact_email: email,
- contact_name: name,
- message
- })
- } )
- .then(response => response.json())
- .then(data => _callback(data) )
- .catch(err => console.log(err))
- }
- }
|