|
|
|
@ -12,29 +12,27 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
sendResults: function () {
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
|
|
fetch("http://www.post-result.com", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({
|
|
|
|
|
homeTeam: this.homeTeam,
|
|
|
|
|
homeScore: this.homeScore,
|
|
|
|
|
awayTeam: this.awayTeam,
|
|
|
|
|
awayScore: this.awayScore
|
|
|
|
|
})
|
|
|
|
|
}).then(response =>{
|
|
|
|
|
if (!response.ok){
|
|
|
|
|
throw new ConnectionError(error.message);
|
|
|
|
|
}
|
|
|
|
|
console.log("Ok, data send successfully");
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
this.errorMessage=error
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}catch (error) {
|
|
|
|
|
fetch("http://www.post-result.com", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({
|
|
|
|
|
homeTeam: this.homeTeam,
|
|
|
|
|
homeScore: this.homeScore,
|
|
|
|
|
awayTeam: this.awayTeam,
|
|
|
|
|
awayScore: this.awayScore
|
|
|
|
|
})
|
|
|
|
|
}).then(response =>{
|
|
|
|
|
if (!response.ok){
|
|
|
|
|
throw new ConnectionError(error.message);
|
|
|
|
|
}
|
|
|
|
|
console.log("Ok, data send successfully");
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
this.errorMessage=error
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
getTeam: function (team) {
|
|
|
|
|
this.allTeam.push(team);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
template: `
|
|
|
|
@ -45,8 +43,7 @@ export default {
|
|
|
|
|
<label for="home-team">Home team:</label>
|
|
|
|
|
<select id="home-team" v-model="homeTeam">
|
|
|
|
|
<option selected disabled >Select a Team</option>
|
|
|
|
|
<option v-for="team in allTeam"
|
|
|
|
|
:name="team.name">{{ name }}
|
|
|
|
|
<option v-for="team in allTeam">{{ team.name }}
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
@ -58,8 +55,7 @@ export default {
|
|
|
|
|
<label for="away-team">Away team:</label>
|
|
|
|
|
<select id="away-team" v-model="awayTeam">
|
|
|
|
|
<option selected disabled>Select a Team</option>
|
|
|
|
|
<option v-for="team in allTeam"
|
|
|
|
|
:name="team.name">{{ name }}
|
|
|
|
|
<option v-for="team in allTeam">{{ team.name }}
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|