uploadToGyazoEasyAuth
2022-02-04
10:52:50 CSP制限に引っかかる?
code:script.js
export async function uploadToGyazoEasyAuth({dataURI, clientId, title}) {
const formData = new FormData();
//console.log({dataURI, clientId, title});
formData.append('image_url', dataURI);
formData.append('client_id', clientId);
formData.append('referer_url', location.href);
formData.append('title', title);
const easyAuth = await fetch(
{
method: 'POST',
mode: 'cors',
credentials: 'include',
body: formData,
},
);
const {get_image_url} = await easyAuth.json();
return (await fetch(get_image_url, {
mode: 'cors',
credentials: 'include',
})).url;
}