You've already forked AstralRinth
forked from didirus/AstralRinth
fix: Properly handle empty version list on version/latest (#3132)
Co-authored-by: Jai Agrawal <18202329+Geometrically@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b2f4366415
commit
fd9653e283
@@ -821,6 +821,13 @@ export default defineNuxtComponent({
|
|||||||
if (route.query.version) {
|
if (route.query.version) {
|
||||||
versionList = versionList.filter((x) => x.game_versions.includes(route.query.version));
|
versionList = versionList.filter((x) => x.game_versions.includes(route.query.version));
|
||||||
}
|
}
|
||||||
|
if (versionList.length === 0) {
|
||||||
|
throw createError({
|
||||||
|
fatal: true,
|
||||||
|
statusCode: 404,
|
||||||
|
message: "No version matches the filters",
|
||||||
|
});
|
||||||
|
}
|
||||||
version = versionList.reduce((a, b) => (a.date_published > b.date_published ? a : b));
|
version = versionList.reduce((a, b) => (a.date_published > b.date_published ? a : b));
|
||||||
} else {
|
} else {
|
||||||
version = props.versions.find((x) => x.id === route.params.version);
|
version = props.versions.find((x) => x.id === route.params.version);
|
||||||
|
|||||||
Reference in New Issue
Block a user