Better error handling, fix some more broken OG links

This commit is contained in:
Geometrically
2021-01-01 09:09:53 -07:00
parent 9de5950f4d
commit a0b6a3bed6
10 changed files with 298 additions and 241 deletions
+17 -3
View File
@@ -1,15 +1,25 @@
<template>
<div class="main">
<h1>{{ error.message }}</h1>
<div class="container">
<NuxtLink to="/">
<h2>{{ error.message }}</h2>
<p>
An error occurred! Click this text to go back home, and find your way
back!
</p>
</NuxtLink>
</div>
<m-footer class="footer" centered />
</div>
</template>
<script>
import MFooter from '@/components/MFooter'
export default {
components: {
MFooter,
},
props: {
error: {
type: Object,
@@ -29,8 +39,12 @@ export default {
<style lang="scss" scoped>
.main {
margin: 0 auto;
margin: var(--spacing-card-sm) auto;
max-width: 800px;
text-align: center;
}
.container {
@extend %card;
padding: var(--spacing-card-md) var(--spacing-card-lg);
}
</style>
-1
View File
@@ -25,7 +25,6 @@
<div class="right hero-image">
<video
src="~/assets/images/search.mp4"
alt="search"
loading="lazy"
loop
muted
+1 -1
View File
@@ -171,7 +171,7 @@ export default {
{
hid: 'og:url',
name: 'og:url',
content: `https://modrinth.com/privacy`,
content: `https://modrinth.com/legal/privacy`,
},
],
},
+1 -1
View File
@@ -183,7 +183,7 @@ export default {
{
hid: 'og:url',
name: 'og:url',
content: `https://modrinth.com/tos`,
content: `https://modrinth.com/legal/terms`,
},
],
},
+7
View File
@@ -282,6 +282,7 @@ export default {
},
}
try {
const [
mod,
availableCategories,
@@ -332,6 +333,12 @@ export default {
license_url: mod.license.url,
// availableDonationPlatforms,
}
} catch {
data.error({
statusCode: 404,
message: 'Mod not found',
})
}
},
data() {
return {
+7
View File
@@ -28,6 +28,7 @@ export default {
},
}
try {
const mod = (
await axios.get(
`https://api.modrinth.com/api/v1/mod/${data.params.id}`,
@@ -72,6 +73,12 @@ export default {
members,
currentMember,
}
} catch {
data.error({
statusCode: 404,
message: 'Mod not found',
})
}
},
data() {
return {
+7
View File
@@ -219,6 +219,7 @@ export default {
},
}
try {
const mod = (
await axios.get(
`https://api.modrinth.com/api/v1/mod/${data.params.id}`,
@@ -268,6 +269,12 @@ export default {
members,
currentMember,
}
} catch {
data.error({
statusCode: 404,
message: 'Mod not found',
})
}
},
data() {
return {
+7
View File
@@ -126,6 +126,7 @@ export default {
},
}
try {
const mod = (
await axios.get(
`https://api.modrinth.com/api/v1/mod/${data.params.id}`,
@@ -182,6 +183,12 @@ export default {
primaryFile,
currentMember,
}
} catch {
data.error({
statusCode: 404,
message: 'Version not found',
})
}
},
data() {
return {
+7
View File
@@ -232,6 +232,7 @@ export default {
},
}
try {
const mod = (
await axios.get(
`https://api.modrinth.com/api/v1/mod/${data.params.id}`,
@@ -280,6 +281,12 @@ export default {
selectableVersions,
currentMember,
}
} catch {
data.error({
statusCode: 404,
message: 'Mod not found',
})
}
},
data() {
return {
+10 -1
View File
@@ -99,6 +99,7 @@ export default {
},
}
try {
let res = await axios.get(
`https://api.modrinth.com/api/v1/user/${data.params.id}`,
config
@@ -112,7 +113,9 @@ export default {
)
if (res.data) {
res = await axios.get(
`https://api.modrinth.com/api/v1/mods?ids=${JSON.stringify(res.data)}`,
`https://api.modrinth.com/api/v1/mods?ids=${JSON.stringify(
res.data
)}`,
config
)
mods = res.data
@@ -122,6 +125,12 @@ export default {
mods,
user,
}
} catch {
data.error({
statusCode: 404,
message: 'User not found',
})
}
},
methods: {
formatNumber(x) {