# fetchで書いて関数化してみた
async function getImageURL(fileKey){
const url = 'https://ドメイン.cybozu.com/k/v1/file.json?fileKey=' + fileKey
const header = new Headers({'X-Requested-with':'XMLHttpRequest'})
const init = {method: 'GET', headers: header, mode: 'cors', cache: 'default}
const res = await fetch(url, init).catch(err => console.log(err))
const blob = await res.blob().catch(err => console.log(err))
const imgURL = (window.URL || window.webkitURL).createObjectURL(blob)
return imgURL
}
エラーハンドリングは適当