diff --git a/src/api/github.ts b/src/api/github.ts index 4e19e71..92160e6 100644 --- a/src/api/github.ts +++ b/src/api/github.ts @@ -11,15 +11,15 @@ const cutToken = 'ghp_qpV8PUxwY7as4jc' const reader = new FileReader() function getBase64(file: File) { return new Promise((resolve) => { - reader.onload = function (event: any) { - const fileContent = event.target.result - resolve(fileContent.split(',')[1]) + reader.onload = function (event) { + const fileContent = event.target && event.target.result + resolve((fileContent as string).split(',')[1]) } reader.readAsDataURL(file) }) } -const putPic = async (file: any) => { +const putPic = async (file: File) => { const repo = 'shawnphang/files' const d = new Date() const content = typeof file === 'string' ? file : await getBase64(file)