fix: undefined functions/properties across frontend (#4210)

* fix: notification mark as read

* revert: composition API change

* fix: categories

* feat: enable vue/no-undef-properties in 'warn' mode.

* fix: app undefined properties

* revert: ss block

* fix: eslint-disable for [version].vue
This commit is contained in:
Cal H.
2025-08-18 12:46:58 +01:00
committed by GitHub
parent 166d14e7e1
commit 5ffe14f058
22 changed files with 684 additions and 556 deletions

View File

@@ -1,4 +1,3 @@
import { injectNotificationManager } from '@modrinth/ui'
import type { Organization, Project, Report, User, Version } from '@modrinth/utils'
type Thread = { id: string }
@@ -156,24 +155,14 @@ function isSimilar(a: PlatformNotification, b: PlatformNotification | undefined)
export async function markAsRead(
ids: string[],
): Promise<(notifications: PlatformNotification[]) => PlatformNotification[]> {
try {
await useBaseFetch(`notifications?ids=${JSON.stringify([...new Set(ids)])}`, {
method: 'PATCH',
await useBaseFetch(`notifications?ids=${JSON.stringify([...new Set(ids)])}`, {
method: 'PATCH',
})
return (notifications: PlatformNotification[]) => {
const newNotifs = notifications ?? []
newNotifs.forEach((n) => {
if (ids.includes(n.id)) n.read = true
})
return (notifications: PlatformNotification[]) => {
const newNotifs = notifications ?? []
newNotifs.forEach((n) => {
if (ids.includes(n.id)) n.read = true
})
return newNotifs
}
} catch (err: any) {
const { addNotification } = injectNotificationManager()
addNotification({
title: 'Error marking notification as read',
text: err?.data?.description ?? err,
type: 'error',
})
return () => []
return newNotifs
}
}