Skip to content

Commit 6cf5128

Browse files
authored
fix(blob): missing import and fix types for useUpload (#156)
1 parent 5ce8472 commit 6cf5128

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/runtime/compsables/useUpload.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ interface UploadOptions extends FetchOptions {
1515
multiple?: boolean
1616
}
1717

18-
export function useUpload(apiBase: string, options: UploadOptions & { multiple: false }): (data: FileList | HTMLInputElement | File[] | File) => Promise<BlobObject>
19-
export function useUpload(apiBase: string, options: UploadOptions): ((data: File) => Promise<BlobObject>) & ((data: FileList | HTMLInputElement | File[]) => Promise<BlobObject[]>)
18+
export function useUpload(apiBase: string, options?: UploadOptions & { multiple: false }): (data: FileList | HTMLInputElement | File[] | File) => Promise<BlobObject>
19+
export function useUpload(apiBase: string, options?: UploadOptions): ((data: File) => Promise<BlobObject>) & ((data: FileList | HTMLInputElement | File[]) => Promise<BlobObject[]>)
2020
export function useUpload(apiBase: string, options: UploadOptions = {}) {
2121
const { formKey = 'files', multiple = true, method, ...fetchOptions } = options || {}
2222

src/runtime/server/utils/blob.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { R2Bucket, ReadableStream, R2MultipartUpload } from '@cloudflare/wo
44
import { ofetch } from 'ofetch'
55
import mime from 'mime'
66
import type { H3Event } from 'h3'
7-
import { setHeader, createError, readFormData, getValidatedQuery, getValidatedRouterParams, readValidatedBody, sendNoContent } from 'h3'
7+
import { setHeader, createError, readFormData, getValidatedQuery, getValidatedRouterParams, readValidatedBody, sendNoContent, assertMethod } from 'h3'
88
import { defu } from 'defu'
99
import { randomUUID } from 'uncrypto'
1010
import { parse } from 'pathe'

0 commit comments

Comments
 (0)