mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
refactor: rename api endpoints
This commit is contained in:
parent
47e255c64a
commit
8e8a72e262
4 changed files with 15 additions and 15 deletions
|
|
@ -15,7 +15,7 @@ axios.defaults.cancelToken = axiosSource.token
|
|||
|
||||
// Add season number to data if the route need it
|
||||
axios.interceptors.request.use(function (config) {
|
||||
if (config.url !== 'summoner-basic' && router.currentRoute.meta.season) {
|
||||
if (config.url !== 'summoner/basic' && router.currentRoute.meta.season) {
|
||||
config.data.season = store.state.summoner.basic.currentSeason
|
||||
}
|
||||
return config
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@ export const actions = {
|
|||
const region = rootState.regionsList[rootState.settings.region]
|
||||
console.log('MATCH DETAILS STORE', gameId, region)
|
||||
|
||||
const resp = await axios(({ url: 'match-details', data: { gameId, region }, method: 'POST' })).catch(() => { })
|
||||
const resp = await axios(({ url: 'match/details', data: { gameId, region }, method: 'POST' })).catch(() => { })
|
||||
console.log('--- DETAILS INFOS ---')
|
||||
console.log(resp.data)
|
||||
commit('MATCH_FOUND', resp.data.matchDetails)
|
||||
|
||||
// If the ranks of the players are not yet known
|
||||
if (resp.data.matchDetails.blueTeam.players[0].rank === undefined) {
|
||||
const ranks = await axios(({ url: 'match-details-ranks', data: { gameId, region }, method: 'POST' })).catch(() => { })
|
||||
const ranks = await axios(({ url: 'match/details/ranks', data: { gameId, region }, method: 'POST' })).catch(() => { })
|
||||
console.log('--- RANK OF MATCH DETAILS ---')
|
||||
console.log(ranks.data)
|
||||
commit('MATCH_RANKS_FOUND', { gameId, ...ranks.data })
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ export const actions = {
|
|||
const regionId = rootState.regionsList[region]
|
||||
commit('BASIC_REQUEST')
|
||||
try {
|
||||
const resp = await axios(({ url: 'summoner-basic', data: { summoner, region: regionId }, method: 'POST' }))
|
||||
const resp = await axios(({ url: 'summoner/basic', data: { summoner, region: regionId }, method: 'POST' }))
|
||||
if (resp.data) {
|
||||
console.log(`---SUMMONER INFOS ${resp.data.account.name}---`)
|
||||
console.log(resp.data)
|
||||
|
|
@ -143,7 +143,7 @@ export const actions = {
|
|||
commit('CHAMPIONS_NOT_FOUND')
|
||||
},
|
||||
async championsRequest({ commit }, queue = null) {
|
||||
const resp = await axios(({ url: 'summoner-champions', data: { puuid: state.basic.account.puuid, queue: queue }, method: 'POST' })).catch(() => { })
|
||||
const resp = await axios(({ url: 'summoner/champions', data: { puuid: state.basic.account.puuid, queue: queue }, method: 'POST' })).catch(() => { })
|
||||
console.log('---CHAMPIONS---')
|
||||
console.log(resp.data)
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ export const actions = {
|
|||
commit('LIVE_LOADING')
|
||||
const region = rootState.regionsList[rootState.settings.region]
|
||||
|
||||
const resp = await axios(({ url: 'summoner-live', data: { account: state.basic.account, region }, method: 'POST' })).catch(() => { })
|
||||
const resp = await axios(({ url: 'summoner/live', data: { account: state.basic.account, region }, method: 'POST' })).catch(() => { })
|
||||
console.log('---LIVE---')
|
||||
console.log(resp.data)
|
||||
|
||||
|
|
@ -176,14 +176,14 @@ export const actions = {
|
|||
commit('MATCHES_FOUND', { newMatches, stats: resp.data.stats })
|
||||
},
|
||||
async overviewRequest({ commit }) {
|
||||
const resp = await axios(({ url: 'summoner-overview', data: { account: state.basic.account }, method: 'POST' })).catch(() => { })
|
||||
const resp = await axios(({ url: 'summoner/overview', data: { account: state.basic.account }, method: 'POST' })).catch(() => { })
|
||||
console.log('---OVERVIEW---')
|
||||
console.log(resp.data)
|
||||
resp.data.matches = createMatchData(resp.data.matchesDetails)
|
||||
commit('OVERVIEW_FOUND', resp.data)
|
||||
},
|
||||
async recordsRequest({ commit }) {
|
||||
const resp = await axios(({ url: 'summoner-records', data: { puuid: state.basic.account.puuid }, method: 'POST' })).catch(() => { })
|
||||
const resp = await axios(({ url: 'summoner/records', data: { puuid: state.basic.account.puuid }, method: 'POST' })).catch(() => { })
|
||||
console.log('---RECORDS---')
|
||||
console.log(resp.data)
|
||||
const records = resp.data ? createRecordsData(resp.data) : {}
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ Route.get('/', async () => {
|
|||
}
|
||||
})
|
||||
|
||||
Route.post('/summoner-basic', 'SummonerController.basic')
|
||||
Route.post('/summoner-overview', 'SummonerController.overview')
|
||||
Route.post('/summoner-champions', 'SummonerController.champions')
|
||||
Route.post('/summoner-records', 'SummonerController.records')
|
||||
Route.post('/summoner-live', 'SummonerController.liveMatchDetails')
|
||||
Route.post('/summoner/basic', 'SummonerController.basic')
|
||||
Route.post('/summoner/overview', 'SummonerController.overview')
|
||||
Route.post('/summoner/champions', 'SummonerController.champions')
|
||||
Route.post('/summoner/records', 'SummonerController.records')
|
||||
Route.post('/summoner/live', 'SummonerController.liveMatchDetails')
|
||||
Route.post('/match', 'MatchController.index')
|
||||
Route.post('/match-details', 'MatchController.show')
|
||||
Route.post('/match-details-ranks', 'MatchController.showRanks')
|
||||
Route.post('/match/details', 'MatchController.show')
|
||||
Route.post('/match/details/ranks', 'MatchController.showRanks')
|
||||
|
|
|
|||
Loading…
Reference in a new issue