mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix errors
This commit is contained in:
@@ -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