Add latest version URLs (Closes #830) (#901)

This commit is contained in:
Prospector
2023-01-11 09:52:43 -08:00
committed by GitHub
parent 2d9293732b
commit 9f6b0e1018
2 changed files with 46 additions and 19 deletions
+17
View File
@@ -1072,6 +1072,22 @@ export default {
this.isEditing = true this.isEditing = true
} }
if (mode === 'latest') {
let versionList = this.versions
if (this.$route.query.loader) {
versionList = versionList.filter((x) =>
x.loaders.includes(this.$route.query.loader)
)
}
if (this.$route.query.version) {
versionList = versionList.filter((x) =>
x.game_versions.includes(this.$route.query.version)
)
}
this.version = versionList.reduce((a, b) =>
a.date_published > b.date_published ? a : b
)
} else {
this.version = this.versions.find( this.version = this.versions.find(
(x) => x.id === this.$route.params.version (x) => x.id === this.$route.params.version
) )
@@ -1096,6 +1112,7 @@ export default {
) )
return return
} }
}
if (!this.version) { if (!this.version) {
this.$nuxt.context.error({ this.$nuxt.context.error({
+10
View File
@@ -0,0 +1,10 @@
<template>
<div></div>
</template>
<script>
export default {
auth: false,
}
</script>
<style lang="scss" scoped></style>