feat: add github api type

This commit is contained in:
IchliebedichZhu 2024-03-13 23:20:14 +00:00
parent f7b8e0b669
commit e977df58e8

View File

@ -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)