fix: swr 2.0 fetcher key args changes

This commit is contained in:
spencerwooo 2023-01-26 14:38:41 +08:00
parent 370a9e622b
commit 21134b36e0
No known key found for this signature in database
GPG key ID: 24CD550268849CA0
2 changed files with 4 additions and 4 deletions

View file

@ -188,10 +188,10 @@ export async function* traverseFolder(path: string): AsyncGenerator<TraverseItem
return {
i,
path,
data: await fetcher(
data: await fetcher([
next ? `/api/?path=${path}&next=${next}` : `/api?path=${path}`,
hashedToken ?? undefined
).catch(error => ({ i, path, error })),
hashedToken ?? undefined,
]).catch(error => ({ i, path, error })),
}
}

View file

@ -6,7 +6,7 @@ import type { OdAPIResponse } from '../types'
import { getStoredToken } from './protectedRouteHandler'
// Common axios fetch function for use with useSWR
export async function fetcher(url: string, token?: string): Promise<any> {
export async function fetcher([url, token]: [url: string, token?: string]): Promise<any> {
try {
return (
await (token