Fix some bugs

This commit is contained in:
Kylart 2017-11-21 18:46:49 +01:00
parent 74ad60b401
commit 16cd15b44e
3 changed files with 24 additions and 18 deletions

View File

@ -96,6 +96,7 @@
},
refresh () {
this.$store.dispatch('history/get')
this.generateHistory()
},
close () {
this.$store.commit('history/setModal', false)

View File

@ -229,6 +229,7 @@
methods: {
close () {
this.$store.commit('mal/showForm', false)
this.form = this.initForm
},
submit () {
const id = this.entry.id
@ -303,11 +304,6 @@
console.error((new Date()).toLocaleTimeString(), e)
}
}
},
show (bool) {
if (!bool) {
this.form = this.initForm
}
}
}
}

View File

@ -76,28 +76,37 @@ export default {
commit('empty')
const {data, status} = await axios.get('getLatestNyaa', { params: state.params })
if (status === 200) commit('set', data)
else if (status === 202) {
log(`An error occurred while getting the latest releases. Retrying in 45 seconds.`)
commit('setInfoSnackbar', 'Could not get the latest releases. Retrying in 45 seconds.', isRoot)
setTimeout(() => {
log(`Retrying to get latest releases.`)
dispatch('refresh').catch(err => { void (err) })
}, 45 * 1000)
} else if (status === 204) {
const {data, status} = await axios.get(`getLatest.json?quality=${state.params.quality}`)
try {
const {data, status} = await axios.get('getLatestNyaa', { params: state.params })
if (status === 200) commit('set', data)
else if (status === 202 || status === 204) {
else if (status === 202) {
log(`An error occurred while getting the latest releases. Retrying in 45 seconds.`)
commit('setInfoSnackbar', 'Could not get the latest releases. Retrying in 45 seconds.', isRoot)
setTimeout(() => {
log(`Retrying to get latest releases.`)
dispatch('refresh').catch(err => { void (err) })
}, 45 * 1000)
} else if (status === 204) {
const {data, status} = await axios.get(`getLatest.json?quality=${state.params.quality}`)
if (status === 200) commit('set', data)
else if (status === 202 || status === 204) {
log(`An error occurred while getting the latest releases. Retrying in 45 seconds.`)
commit('setInfoSnackbar', 'Could not get the latest releases. Retrying in 45 seconds.', isRoot)
setTimeout(() => {
log(`Retrying to get latest releases.`)
dispatch('refresh').catch(err => { void (err) })
}, 45 * 1000)
}
}
} catch (e) {
log(`An error occurred while getting the latest releases. Retrying in 45 seconds.`, e)
commit('setInfoSnackbar', 'Could not get the latest releases. Retrying in 45 seconds.', isRoot)
setTimeout(() => {
log(`Retrying to get latest releases.`)
dispatch('refresh').catch(err => { void (err) })
}, 45 * 1000)
}
},
async autoRefresh ({dispatch, commit, state}) {