From e977df58e87cf0af607f20b70469681f68e6750e Mon Sep 17 00:00:00 2001 From: IchliebedichZhu <54796446@qq.com> Date: Wed, 13 Mar 2024 23:20:14 +0000 Subject: [PATCH] feat: add github api type --- src/api/github.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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)