feat: custom webapp logo (#1766)

This commit is contained in:
zxhlyh
2023-12-18 16:25:37 +08:00
committed by GitHub
parent 65fd4b39ce
commit 5bb841935e
40 changed files with 888 additions and 24 deletions

View File

@@ -6,13 +6,13 @@ type ImageUploadParams = {
onSuccessCallback: (res: { id: string }) => void
onErrorCallback: () => void
}
type ImageUpload = (v: ImageUploadParams, isPublic?: boolean) => void
type ImageUpload = (v: ImageUploadParams, isPublic?: boolean, url?: string) => void
export const imageUpload: ImageUpload = ({
file,
onProgressCallback,
onSuccessCallback,
onErrorCallback,
}, isPublic) => {
}, isPublic, url) => {
const formData = new FormData()
formData.append('file', file)
const onProgress = (e: ProgressEvent) => {
@@ -26,7 +26,7 @@ export const imageUpload: ImageUpload = ({
xhr: new XMLHttpRequest(),
data: formData,
onprogress: onProgress,
}, isPublic)
}, isPublic, url)
.then((res: { id: string }) => {
onSuccessCallback(res)
})