function getRegions() {
- return [ "euw", "na", "kr", "br" ];
+ $.ajax("/lol/regions")
+ .done((data) => {
+ app.regions = JSON.parse(data);
+ });
}
function getChampions() {
- return [ {name: "Aatrox"}, {name: "Annie"}, {name: "Braum"}, {name: "Not"} ];
+ $.ajax("/lol/champions")
+ .done((data) => {
+ app.champions = JSON.parse(data);
+ });
}
function getMatchProps() {
return [
];
}
function getMatches() {
- return [
- {champ: "Xerath", lane: "Middle"},
- {champ: "Quinn", lane: "Bottom"},
- ];
+ $.ajax("/lol/matches?region=" + app.region + "&summoner=" + app.summoner)
+ .done((data) => {
+ app.matches = JSON.parse(data);
+ });
}
function getInfo() {
app.summoner = $("#nameinput").val();
summoner: "",
region: "",
view: "",
- regions: getRegions(),
- champions: getChampions(),
- matchprops: getMatchProps(),
- matches: getMatches(),
+ regions: [],
+ champions: [],
+ matchprops: [],
+ matches: [],
},
methods: {
submit: function() {
setUrl();
},
refreshHistory: function() {
+ getMatches();
},
},
});
window.addEventListener('load', () => {
let view = parseUrl();
setView(view);
+ getRegions();
+ getChampions();
});