diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-08-22 14:56:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-22 14:56:07 +0300 |
commit | 89f038c7a0ccf6de94516cba8499a0bc69f8dae1 (patch) | |
tree | 5e6dbd7ae5a9d0ce1b79921b2b44986bb13f1874 /src/containers/PollCreation/PollCreation.tsx | |
parent | a42667af463b8c33a38b935b96d39582b543790b (diff) | |
parent | 93319d38e904535ce33a7868b3c1e0a2a4f33d65 (diff) | |
download | which-ui-89f038c7a0ccf6de94516cba8499a0bc69f8dae1.tar.gz |
Merge pull request #93 from which-ecosystem/avatar-uploads
Avatar uploads
Diffstat (limited to 'src/containers/PollCreation/PollCreation.tsx')
-rw-r--r-- | src/containers/PollCreation/PollCreation.tsx | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/containers/PollCreation/PollCreation.tsx b/src/containers/PollCreation/PollCreation.tsx index 03ab905..ecc6757 100644 --- a/src/containers/PollCreation/PollCreation.tsx +++ b/src/containers/PollCreation/PollCreation.tsx @@ -1,4 +1,3 @@ -/* eslint-disable */ import React from 'react'; import Bluebird from 'bluebird'; import { useHistory } from 'react-router-dom'; @@ -12,12 +11,12 @@ import { } from '@material-ui/core'; import { useSnackbar } from 'notistack'; +import useS3Preupload from './useS3Preupload'; import ImageInput from './ImageInput'; import UserStrip from '../../components/UserStrip/UserStrip'; import { post } from '../../requests'; import { useAuth } from '../../hooks/useAuth'; import { useFeed } from '../../hooks/APIClient'; -import useS3Preupload from '../../hooks/useS3Preupload'; const useStyles = makeStyles(theme => ({ @@ -38,23 +37,21 @@ const PollCreation: React.FC = () => { const { user } = useAuth(); const { mutate: updateFeed } = useFeed(); const { - setValue: setLeft, - progress: progressLeft, + file: left, + setFile: setLeft, resolve: resolveLeft, - isReady: isLeftReady + progress: leftProgress } = useS3Preupload(); const { - setValue: setRight, - progress: progressRight, + file: right, + setFile: setRight, resolve: resolveRight, - isReady: isRightReady + progress: rightProgress } = useS3Preupload(); 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 }, @@ -79,16 +76,16 @@ const PollCreation: React.FC = () => { {user && <UserStrip user={user} info="" />} <Divider /> <div className={classes.images}> - <ImageInput callback={setLeft} progress={progressLeft} /> - <ImageInput callback={setRight} progress={progressRight} /> + <ImageInput callback={setLeft} progress={leftProgress} /> + <ImageInput callback={setRight} progress={rightProgress} /> </div> { - progressLeft || progressRight + leftProgress || rightProgress ? <LinearProgress color="primary" /> : ( <Button color="primary" - disabled={!(isLeftReady && isRightReady)} + disabled={!(left && right)} variant="contained" onClick={handleClick} fullWidth |