az-aws3
v0.0.4
Published
az-aws3 react react-native vue js
Downloads
1
Maintainers
Readme
import AwsManager from 'az-aws3'
// 请求密钥的Promise
credentials(){
return new Promise((resolve, reject) => {
fetch('https://domain.com/1.0/common/get-credentials')
.then(response => {
return response.text()
})
.then(responseText=>{
let responseData = JSON.parse(responseText);
const { code, data } = responseData;
if (code === 0) {
resolve(data);
} else {
reject(responseData)
}
}).catch(err=>{
reject(err)
})
})
}
// 配置方法请求密钥
AwsManager.configMethod(this.credentials)
/****单例模式,配置一次即可***/
// 上传文件
onGetFile3(e){
const file = e.target.files[0]
AwsManager.uploadFiles(file,(resp)=>{
console.log('uploadFiles---------callBack--------', resp);
})
}