mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix errors
This commit is contained in:
@@ -198,7 +198,7 @@ const ReplyModal = ({ isOpen, closeModal }) => {
|
||||
|
||||
if (!storedSigners[selectedParentCid]) {
|
||||
signer = await account.plebbit.createSigner();
|
||||
storedSigners[selectedParentCid] = { privateKey: signer.privateKey, address: signer.address };
|
||||
storedSigners[selectedParentCid] = { privateKey: signer?.privateKey, address: signer?.address };
|
||||
localStorage.setItem('storedSigners', JSON.stringify(storedSigners));
|
||||
|
||||
} else {
|
||||
@@ -207,7 +207,7 @@ const ReplyModal = ({ isOpen, closeModal }) => {
|
||||
try {
|
||||
signer = await account.plebbit.createSigner({type: 'ed25519', privateKey: signerPrivateKey});
|
||||
} catch (error) {
|
||||
setNewErrorMessage(error);
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ const ReplyModal = ({ isOpen, closeModal }) => {
|
||||
signer,
|
||||
author: {
|
||||
...prevPublishCommentOptions.author,
|
||||
address: signer.address
|
||||
address: signer?.address
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
@@ -390,7 +390,7 @@ const Board = () => {
|
||||
|
||||
if (!storedSigners[selectedThreadCidRef]) {
|
||||
signer = await account.plebbit.createSigner();
|
||||
storedSigners[selectedThreadCidRef] = { privateKey: signer.privateKey, address: signer.address };
|
||||
storedSigners[selectedThreadCidRef] = { privateKey: signer?.privateKey, address: signer?.address };
|
||||
localStorage.setItem('storedSigners', JSON.stringify(storedSigners));
|
||||
|
||||
} else {
|
||||
@@ -399,7 +399,7 @@ const Board = () => {
|
||||
try {
|
||||
signer = await account.plebbit.createSigner({type: 'ed25519', privateKey: signerPrivateKey});
|
||||
} catch (error) {
|
||||
setNewErrorMessage(error);
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ const Board = () => {
|
||||
signer,
|
||||
author: {
|
||||
...prevPublishCommentOptions.author,
|
||||
address: signer.address
|
||||
address: signer?.address
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
@@ -357,7 +357,7 @@ const Thread = () => {
|
||||
|
||||
if (!storedSigners[selectedThread]) {
|
||||
signer = await account.plebbit.createSigner();
|
||||
storedSigners[selectedThread] = { privateKey: signer.privateKey, address: signer.address };
|
||||
storedSigners[selectedThread] = { privateKey: signer?.privateKey, address: signer?.address };
|
||||
localStorage.setItem('storedSigners', JSON.stringify(storedSigners));
|
||||
|
||||
} else {
|
||||
@@ -366,7 +366,7 @@ const Thread = () => {
|
||||
try {
|
||||
signer = await account.plebbit.createSigner({type: 'ed25519', privateKey: signerPrivateKey});
|
||||
} catch (error) {
|
||||
setNewErrorMessage(error);
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ const Thread = () => {
|
||||
signer,
|
||||
author: {
|
||||
...prevPublishCommentOptions.author,
|
||||
address: signer.address
|
||||
address: signer?.address
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useAccount } from "@plebbit/plebbit-react-hooks";
|
||||
import useAnonModeStore from "./stores/useAnonModeStore";
|
||||
|
||||
const useAnonMode = (threadCid, execute) => {
|
||||
const { account } = useAccount();
|
||||
const account = useAccount();
|
||||
const { anonymousMode } = useAnonModeStore();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -13,7 +13,9 @@ useEffect(() => {
|
||||
if (!anonymousMode) {
|
||||
if (execute && storedSigners[threadCid]) {
|
||||
const signerPrivateKey = storedSigners[threadCid];
|
||||
await account.plebbit.createSigner({privateKey: signerPrivateKey});
|
||||
if (account) {
|
||||
await account.plebbit.createSigner({privateKey: signerPrivateKey});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { setActiveAccount, useAccount } from "@plebbit/plebbit-react-hooks";
|
||||
import useAnonModeStore from "./stores/useAnonModeStore";
|
||||
|
||||
const useAnonModeRef = (threadCidRef, execute) => {
|
||||
const { account } = useAccount();
|
||||
const account = useAccount();
|
||||
const { anonymousMode } = useAnonModeStore();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -13,13 +13,13 @@ const useAnonModeRef = (threadCidRef, execute) => {
|
||||
if (!anonymousMode) return;
|
||||
|
||||
if (!storedSigners[threadCidRef] && execute) {
|
||||
const signer = await account.plebbit.createSigner();
|
||||
const signer = await account?.plebbit.createSigner();
|
||||
storedSigners[threadCidRef] = signer.privateKey;
|
||||
|
||||
localStorage.setItem('storedSigners', JSON.stringify(storedSigners));
|
||||
} else {
|
||||
const signerPrivateKey = storedSigners[threadCidRef];
|
||||
const signer = await account.plebbit.createSigner({privateKey: signerPrivateKey});
|
||||
const signer = await account?.plebbit.createSigner({privateKey: signerPrivateKey});
|
||||
await setActiveAccount(account, {signer});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user