Fix error message and use new backend response
This commit is contained in:
@ -44,8 +44,6 @@ export default {
|
||||
const [set1, set2] = [new Set(wantedTags), new Set(tags)]
|
||||
const common = [...set1].filter((x) => set2.has(x))
|
||||
|
||||
console.log(wantedTags)
|
||||
|
||||
if (common.length === wantedTags.length) {
|
||||
category.style.display = ''
|
||||
} else if (wantedTags[0] === '') {
|
||||
@ -91,10 +89,13 @@ export default {
|
||||
|
||||
try {
|
||||
const res = await fetch(`${this.protocol}${import.meta.env.VITE_BACKEND_DOMAIN}/api/discover`)
|
||||
if (!res.ok) {
|
||||
throw new Error('Failed to fetch data')
|
||||
const rawData = await res.json()
|
||||
if (rawData.status === "ok") {
|
||||
this.data = rawData.data
|
||||
} else {
|
||||
this.data = { status: 'error' }
|
||||
}
|
||||
this.data = await res.json()
|
||||
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
this.data = { status: 'error' }
|
||||
|
Reference in New Issue
Block a user