Skip to content

Instantly share code, notes, and snippets.

@vitorvargasdev
Created November 3, 2019 10:27
Show Gist options
  • Save vitorvargasdev/843e3c9834b3cef2abc807a01611b01b to your computer and use it in GitHub Desktop.
Save vitorvargasdev/843e3c9834b3cef2abc807a01611b01b to your computer and use it in GitHub Desktop.
<template>
<div>
<div v-for="odd in odds" :key="odd.id">
<span v-if="teste(odd)">{{ odd }}</span>
</div>
</div>
</template>
<script>
import axios from "axios";
axios.defaults.headers.common = {
"X-Requested-With": "XMLHttpRequest",
"X-CSRF-TOKEN": window.csrf_token
};
export default {
data() {
return {
odds: "",
show: false
};
},
methods: {
full_time_result_load(id) {
async function odds() {
let res = await axios.post("/api/inPlayEvent", { id });
return res;
}
odds().then(response => {
this.odds = response.data;
});
},
teste(payload) {
switch(payload.type)
{
case "MA":
switch(payload.NA)
{
case "Fulltime Result":
this.show = true
break;
default:
this.show = false
break;
}
break;
case "PA":
if(this.show == true)
{
return true
}
break;
}
}
},
mounted() {
this.full_time_result_load(123);
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment