<script src="./index.umd.min.js"></script>
FBClient.setBaseURL('https://xxx.cc.com')
FBClient.setExtraHeaders({ 'X-CUSTOM-HEADER': 'VALUE' })
FBClient.query.GetT({input:{id:1}}).then(console.log)
FBClient.mutation.CreateT({input:{name:"sss",des:"des"}}).then(console.log)
FBClient.subscription.GetT({input:{id:1},liveQuery: true}).then(async res => {
for await (const v of res) {
console.log(v)
}
})
FBClient.subscription.GetT({input:{id:1}}).then(async res => {
for await (const v of res) {
console.log(v)
}
})
FBClient.subscription.GetT({input:{id:1},subscribeOnce: true}, ({ data, error }) => {
console.log(data)
})
<input type="file" id="fileInput" name="fileInput" >
<script>
const fileInput = document.getElementById('fileInput');
fileInput.addEventListener('change', (event) => {
const files = event.target.files
if (files == null) return
// 调用上传函数
FBClient.uploadFiles({
provider: 'tengxunyun',
files: files,
profile: 'avatar', // (可选)高级配置
directory:"sss", // (可选)上传目录
meta:{ // (可选)meta信息
postId:"sss"
}
})
});
</script>
FBClient.logout({
logoutOpenidConnectProvider: true,
});
FBClient.setAuthorizationToken('<access_token>')