演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
643 B
TypeScript
20 lines
643 B
TypeScript
import type { fileUpload } from './utils'
|
|
import type { uploadPublicRemoteFileInfo } from '@/service/common'
|
|
import { createContext, use } from 'react'
|
|
|
|
/** The surface owns upload authorization; local failures use the supplied callbacks. */
|
|
export type FileUploadStrategy = {
|
|
uploadLocal: (params: Parameters<typeof fileUpload>[0]) => void
|
|
uploadRemote: (url: string) => ReturnType<typeof uploadPublicRemoteFileInfo>
|
|
}
|
|
|
|
export const FileUploadContext = createContext<{
|
|
localUploadUrl?: string
|
|
trialAppId?: string
|
|
uploadStrategy?: FileUploadStrategy
|
|
}>({})
|
|
|
|
export function useFileUploadContext() {
|
|
return use(FileUploadContext)
|
|
}
|