mirror of
https://github.com/status-im/liquid-funding.git
synced 2025-02-16 21:36:46 +00:00
persist update
This commit is contained in:
parent
797678ca9f
commit
89f7ab0860
@ -14,7 +14,6 @@ import { isEmpty } from 'ramda'
|
|||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { uploadFilesToIpfs, pinToGateway, formatMedia, isWeb } from '../../utils/ipfs'
|
import { uploadFilesToIpfs, pinToGateway, formatMedia, isWeb } from '../../utils/ipfs'
|
||||||
import { FundingContext } from '../../context'
|
import { FundingContext } from '../../context'
|
||||||
import {ZERO_ADDRESS} from '../../utils/address'
|
|
||||||
import CurrencySelect from '../base/CurrencySelect'
|
import CurrencySelect from '../base/CurrencySelect'
|
||||||
import StatusTextField from '../base/TextField'
|
import StatusTextField from '../base/TextField'
|
||||||
import IconTextField from '../base/IconTextField'
|
import IconTextField from '../base/IconTextField'
|
||||||
@ -28,7 +27,7 @@ import BreadCrumb from '../base/BreadCrumb'
|
|||||||
import { errorStrings } from '../../constants/errors'
|
import { errorStrings } from '../../constants/errors'
|
||||||
import { getProfileById } from './queries'
|
import { getProfileById } from './queries'
|
||||||
import Loading from '../base/Loading'
|
import Loading from '../base/Loading'
|
||||||
const { addProject } = LiquidPledging.methods
|
const { updateProject } = LiquidPledging.methods
|
||||||
const { TOO_LONG, REQUIRED } = errorStrings
|
const { TOO_LONG, REQUIRED } = errorStrings
|
||||||
|
|
||||||
const hoursToSeconds = hours => hours * 60 * 60
|
const hoursToSeconds = hours => hours * 60 * 60
|
||||||
@ -198,7 +197,7 @@ const addProjectSucessMsg = response => {
|
|||||||
const { events: { ProjectAdded: { returnValues: { idProject } } } } = response
|
const { events: { ProjectAdded: { returnValues: { idProject } } } } = response
|
||||||
return `Project created with ID of ${idProject}, will redirect to your new project page in a few seconds`
|
return `Project created with ID of ${idProject}, will redirect to your new project page in a few seconds`
|
||||||
}
|
}
|
||||||
const SubmissionSection = ({ classes, history, projectData }) => {
|
const SubmissionSection = ({ classes, history, projectData, projectId }) => {
|
||||||
const [uploads, setUploads] = useState({})
|
const [uploads, setUploads] = useState({})
|
||||||
const { account, currencies, enableEthereum, openSnackBar, prices } = useContext(FundingContext)
|
const { account, currencies, enableEthereum, openSnackBar, prices } = useContext(FundingContext)
|
||||||
const windowSize = useWindowSize()
|
const windowSize = useWindowSize()
|
||||||
@ -227,12 +226,12 @@ const SubmissionSection = ({ classes, history, projectData }) => {
|
|||||||
const manifest = createJSON(values)
|
const manifest = createJSON(values)
|
||||||
const contentHash = await uploadFilesToIpfs(uploads, manifest)
|
const contentHash = await uploadFilesToIpfs(uploads, manifest)
|
||||||
uploadFilesToIpfs(uploads, manifest, true)
|
uploadFilesToIpfs(uploads, manifest, true)
|
||||||
const args = [title, contentHash, user, 0, hoursToSeconds(commitTime), ZERO_ADDRESS]
|
const args = [projectId, user, title, contentHash, hoursToSeconds(commitTime)]
|
||||||
console.log({args})
|
console.log({args})
|
||||||
addProject(...args)
|
updateProject(...args)
|
||||||
.estimateGas({ from: user })
|
.estimateGas({ from: user })
|
||||||
.then(async gas => {
|
.then(async gas => {
|
||||||
addProject(...args)
|
updateProject(...args)
|
||||||
.send({ from: user, gas: gas + 100 })
|
.send({ from: user, gas: gas + 100 })
|
||||||
.then(async res => {
|
.then(async res => {
|
||||||
pinToGateway(contentHash)
|
pinToGateway(contentHash)
|
||||||
@ -488,11 +487,15 @@ function UpdateProject({ match, classes, history }) {
|
|||||||
const projectData = useProjectData(projectId, data)
|
const projectData = useProjectData(projectId, data)
|
||||||
if (loading) return <Loading />
|
if (loading) return <Loading />
|
||||||
if (error) return <div>{`Error! ${error.message}`}</div>
|
if (error) return <div>{`Error! ${error.message}`}</div>
|
||||||
console.log({projectData})
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
<SubmissionSection classes={classes} history={history} projectData={projectData} />
|
<SubmissionSection
|
||||||
|
classes={classes}
|
||||||
|
history={history}
|
||||||
|
projectData={projectData}
|
||||||
|
projectId={projectId}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user