mirror of
https://github.com/palxiao/poster-design.git
synced 2025-07-15 16:02:19 +08:00
feat: add github api type
This commit is contained in:
parent
f7b8e0b669
commit
e977df58e8
@ -11,15 +11,15 @@ const cutToken = 'ghp_qpV8PUxwY7as4jc'
|
|||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
function getBase64(file: File) {
|
function getBase64(file: File) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
reader.onload = function (event: any) {
|
reader.onload = function (event) {
|
||||||
const fileContent = event.target.result
|
const fileContent = event.target && event.target.result
|
||||||
resolve(fileContent.split(',')[1])
|
resolve((fileContent as string).split(',')[1])
|
||||||
}
|
}
|
||||||
reader.readAsDataURL(file)
|
reader.readAsDataURL(file)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const putPic = async (file: any) => {
|
const putPic = async (file: File) => {
|
||||||
const repo = 'shawnphang/files'
|
const repo = 'shawnphang/files'
|
||||||
const d = new Date()
|
const d = new Date()
|
||||||
const content = typeof file === 'string' ? file : await getBase64(file)
|
const content = typeof file === 'string' ? file : await getBase64(file)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user