From e690434af7e24d33bf59ea0d7307e173a70707af Mon Sep 17 00:00:00 2001 From: rirohan Date: Thu, 24 Feb 2022 19:35:27 +0530 Subject: [PATCH] Add changes for secret key --- src/EditingPage/Modal.js | 84 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 79 insertions(+), 5 deletions(-) diff --git a/src/EditingPage/Modal.js b/src/EditingPage/Modal.js index 0a64126..b6f014a 100644 --- a/src/EditingPage/Modal.js +++ b/src/EditingPage/Modal.js @@ -5,6 +5,7 @@ import { Modal } from "@material-ui/core"; import { Fade, Button, TextField } from "@material-ui/core"; import { NumberOfCopies, ObjectContext, TreeContext } from "./EditingPage"; import { DemoCarousel } from "./Carousel"; +import { ToastContainer, toast } from "react-toastify"; import axios from "axios"; const style = { @@ -30,6 +31,7 @@ export const ModalComponent = (props) => { const [description, setDescription] = React.useState(""); const [URL, setURL] = React.useState(""); const [next, setNext] = React.useState(false); + const [code, setCode] = React.useState(""); const handleClick = async () => { const data = { @@ -56,10 +58,28 @@ export const ModalComponent = (props) => { }); }; + const handleFormSubmit = async () => { + const data = { + hash: code, + totalCopies: total, + }; + const response = await axios + .post("https://sickalien.store/validate", data) + .then(function (res) { + setNext(true); + toast.success("Secret Code Validated"); + }) + .catch(function (error) { + toast.info(error); + toast.error("Try Again"); + }); + }; + const handleModalClose = () => { setNext(false); props.handleClose(); }; + return (
{ marginLeft: "1%", }} > - NFT Copies base name : + NFT Project name :
{ marginLeft: "1%", }} > - External Link : + External Link (Website): { borderRadius: "10px", }} /> +
+

Get your Secret Key ={">"} 

+ Click Here +
+
+ { + setCode(event.target.value); + }} + style={{ + justifyContent: "flex-start", + display: "flex", + width: "600px", + marginLeft: "10px", + borderRadius: "10px", + backgroundColor: "#fff", + }} + /> +
{ variant="contained" color="secondary" size="large" - onClick={() => { - setNext(true); - }} + onClick={handleFormSubmit} > Next @@ -230,6 +291,19 @@ export const ModalComponent = (props) => { +
+ +
); };