1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00

typing fixes

This commit is contained in:
Matthias Kretschmann 2020-10-20 21:33:11 +02:00
parent 0497904bb5
commit 8d7eec69fa
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 10 additions and 7 deletions

View File

@ -34,7 +34,7 @@ export default function FormPricing({
useEffect(() => {
const dtAmount = Number(price) * Number(weightOnDataToken)
setFieldValue('dtAmount', dtAmount)
}, [price])
}, [price, weightOnDataToken])
const tabs = [
{

View File

@ -50,18 +50,20 @@ export default function Pricing({ ddo }: { ddo: DDO }): ReactElement {
const data = useStaticQuery(query)
const content = data.content.edges[0].node.childContentJson.create
// View states
const [showPricing, setShowPricing] = useState(false)
const [success, setSuccess] = useState<string>()
const {
createPricing,
pricingIsLoading,
pricingError,
pricingStepText
} = usePricing(ddo)
const [showPricing, setShowPricing] = useState(false)
const [success, setSuccess] = useState<string>()
const hasFeedback = pricingIsLoading || success
const hasFeedback = pricingIsLoading || typeof success !== 'undefined'
async function handleCreatePricing(values: Partial<PriceOptionsMarket>) {
async function handleCreatePricing(values: PriceOptionsMarket) {
try {
const priceOptions = {
...values,
@ -78,7 +80,8 @@ export default function Pricing({ ddo }: { ddo: DDO }): ReactElement {
}
// Pricing succeeded
setSuccess(`🎉 Successfully created a ${values.type} price. 🎉`)
setSuccess(`🎉 Successfully created a ${values.type} price. 🎉 `)
Logger.log(`Transaction: ${tx}`)
} catch (error) {
toast.error(error.message)
Logger.error(error.message)

View File

@ -15,7 +15,7 @@ export const validationSchema = Yup.object().shape<PriceOptionsMarket>({
.nullable()
})
export const initialValues: Partial<PriceOptionsMarket> = {
export const initialValues: PriceOptionsMarket = {
price: 1,
type: 'dynamic',
dtAmount: 1,