Skip to content

Commit

Permalink
test json data
Browse files Browse the repository at this point in the history
  • Loading branch information
nikos-koukis committed Oct 13, 2023
1 parent 8fbf165 commit 89152bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/views/Home/components/NewUserForm/CreateWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ interface CreateWalletProps {
handleReset: () => void;
userGid: string;
setClickSubmit: React.Dispatch<React.SetStateAction<boolean>>;
onJsonPrettyChange: (jsonPretty: string) => void;
}

export default function CreateWallet({ pin, email, handleReset, userGid, setClickSubmit }: CreateWalletProps) {
export default function CreateWallet({ pin, email, handleReset, userGid, setClickSubmit, onJsonPrettyChange }: CreateWalletProps) {

const [encryptionKey, setEncryptionKey] = useState(createEncryptionKey(pin, userGid));
const [walletCreationHash, setWalletCreationHash] = useState("");
const [txDetails, setTxDetails] = useState('');
const [jsonPretty, setJsonPretty] = useState('');

useEffect(() => {
if (walletCreationHash != "") {
Expand Down Expand Up @@ -157,7 +159,8 @@ interface CreateWalletProps {
const jsonPretty = JSON.stringify(jsonFileContent);

setJsonFileContent(jsonPretty);
console.log("jsonPretty", jsonPretty)
setJsonPretty(jsonPretty);
onJsonPrettyChange(jsonPretty);
} catch (error) {
console.error(error);
}
Expand Down
9 changes: 8 additions & 1 deletion src/views/Home/components/NewUserForm/NewUserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ function NewUserForm({ email, userGid, setClickedSubmit }: NewUserFormProps) {
setClickedSubmit(true);
}

const [jsonPrettyData, setJsonPrettyData] = useState('');
const handleJsonPrettyChange = (data: any) => {
setJsonPrettyData(data);
console.log("json pretty data", data)
}
return (
<Box px={20} marginTop={'100px'}>
<Flex flexDir="column" width="100%">
Expand Down Expand Up @@ -108,7 +113,9 @@ function NewUserForm({ email, userGid, setClickedSubmit }: NewUserFormProps) {
/>
)}
{index === 1 && isPinFilled && (
<CreateWallet pin={pin} email={email} handleReset={handleReset} userGid={userGid} setClickSubmit={handleCreateWalletSubmit }/>
<CreateWallet pin={pin} email={email} handleReset={handleReset} userGid={userGid} setClickSubmit={handleCreateWalletSubmit }
onJsonPrettyChange={handleJsonPrettyChange}
/>
)}
{index === 2 && userInfo && !isLoadingUserInfo &&
<ViewWallet userInfo={userInfo} isLoadingUserInfo={isLoadingUserInfo} />
Expand Down

0 comments on commit 89152bc

Please sign in to comment.