Fix the region changes with the new Jax wrapper

This commit is contained in:
Valentin Kaelin 2019-09-09 18:14:15 +02:00
parent 56f78fc8a2
commit 0aba0954e4
4 changed files with 9 additions and 2 deletions

View file

@ -29,6 +29,7 @@ export const mutations = {
export const actions = {
async summonerRequest({ commit, dispatch, rootState }, { summoner, region }) {
console.log(summoner, region)
region = rootState.regionsList[region]
commit('SUMMONER_REQUEST')
try {
const resp = await axios(({ url: 'api', data: { summoner, region }, method: 'POST' }))

View file

@ -76,7 +76,6 @@ export default {
return this.$route.params.region
},
...mapState({
regionsList: state => state.regionsList,
localInfos: state => state.summoner.infos,
summonerFound: state => state.summoner.summonerFound,
loading: state => state.summoner.loading

View file

@ -39,6 +39,13 @@ class Jax {
set regionName(regionName) {
this.region = regionName
const blacklistedProperties = ['key', 'limiter', 'region', 'version', 'DDragon']
for (const key of Object.getOwnPropertyNames(this)) {
if(blacklistedProperties.includes(key)) continue
this[key].region = regionName
}
}
}

View file

@ -7,7 +7,7 @@ const app = express()
import { Jax } from "./Jax"
/* Set Port */
app.set('port', (process.env.PORT || 5000))
app.set('port', (process.env.PORT || 3333))
/* Setup Cors */
app.use(cors({