fix: more eslint issues

This commit is contained in:
Huskydog9988
2025-04-13 22:10:28 -04:00
parent 86c2d00726
commit e362f732e7
18 changed files with 71 additions and 66 deletions

View File

@@ -6,7 +6,7 @@ type FullCollection = Collection & {
};
export const useCollections = async () => {
// @ts-expect-error
// @ts-expect-error undefined is used to tell if value has been fetched or not
const state = useState<FullCollection[]>("collections", () => undefined);
if (state.value === undefined) {
state.value = await $dropFetch<FullCollection[]>("/api/v1/collection");
@@ -17,7 +17,9 @@ export const useCollections = async () => {
export async function refreshCollection(id: string) {
const state = useState<FullCollection[]>("collections");
const collection = await $dropFetch<FullCollection>(`/api/v1/collection/${id}`);
const collection = await $dropFetch<FullCollection>(
`/api/v1/collection/${id}`,
);
const index = state.value.findIndex((e) => e.id == id);
if (index == -1) {
state.value.push(collection);
@@ -27,7 +29,7 @@ export async function refreshCollection(id: string) {
}
export const useLibrary = async () => {
// @ts-expect-error
// @ts-expect-error undefined is used to tell if value has been fetched or not
const state = useState<FullCollection>("library", () => undefined);
if (state.value === undefined) {
await refreshLibrary();

View File

@@ -31,7 +31,7 @@ export const fetchNews = async (options?: {
const news = useNews();
// @ts-ignore
// @ts-ignore forget why this ignor exists
const newValue = await $dropFetch(`/api/v1/news?${query.toString()}`);
news.value = newValue;

View File

@@ -1,5 +1,4 @@
import type {
$Fetch,
ExtractedRouteMethod,
NitroFetchOptions,
NitroFetchRequest,
@@ -8,15 +7,15 @@ import type {
interface DropFetch<
DefaultT = unknown,
DefaultR extends NitroFetchRequest = NitroFetchRequest
DefaultR extends NitroFetchRequest = NitroFetchRequest,
> {
<
T = DefaultT,
R extends NitroFetchRequest = DefaultR,
O extends NitroFetchOptions<R> = NitroFetchOptions<R>
O extends NitroFetchOptions<R> = NitroFetchOptions<R>,
>(
request: R,
opts?: O
opts?: O,
): Promise<
// @ts-ignore
TypedInternalResponse<