diff options
-rw-r--r-- | src/containers/PollCreation/PollCreation.tsx | 2 | ||||
-rw-r--r-- | src/hooks/useS3Preupload.tsx | 15 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/containers/PollCreation/PollCreation.tsx b/src/containers/PollCreation/PollCreation.tsx index 489c12a..6821544 100644 --- a/src/containers/PollCreation/PollCreation.tsx +++ b/src/containers/PollCreation/PollCreation.tsx @@ -52,6 +52,8 @@ const PollCreation: React.FC = () => { const handleClick = async () => { try { const [leftUrl, rightUrl] = await Bluebird.all([resolveLeft(), resolveRight()]); + console.log('leftUrl', leftUrl); + console.log('rightUrl', rightUrl); const contents = { left: { url: leftUrl }, diff --git a/src/hooks/useS3Preupload.tsx b/src/hooks/useS3Preupload.tsx index 3545cd5..a87eda0 100644 --- a/src/hooks/useS3Preupload.tsx +++ b/src/hooks/useS3Preupload.tsx @@ -46,15 +46,24 @@ export default (): Hook => { setProgress(0.01); return get('/files') - .then(response => response.data) - .then(uploadUrl => axios.put(uploadUrl, file, config)) - .then(response => { + .then(function(response){ + console.log({'resData': response.data}); + debugger; + return response.data; + }) + .then(function(uploadUrl){ + console.log({'uploadUrl': uploadUrl}); + return axios.put(uploadUrl, file, config); + }) + .then(function(response){ setProgress(100); const uri = response.config.url; + console.log({'uri': uri?.slice(0, uri.indexOf('?'))}); return uri ? uri.slice(0, uri.indexOf('?')) : ''; }); } setProgress(100); + console.log({'url': url}); return url || ''; }, [file, handleUploadProgress, url]); |