mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
@@ -3,7 +3,7 @@ import { createAccount, setActiveAccount, useAccounts } from "@plebbit/plebbit-r
|
|||||||
import useAnonModeStore from "./stores/useAnonModeStore";
|
import useAnonModeStore from "./stores/useAnonModeStore";
|
||||||
|
|
||||||
const useAnonMode = (threadCid, execute) => {
|
const useAnonMode = (threadCid, execute) => {
|
||||||
const {accounts} = useAccounts();
|
const { accounts } = useAccounts();
|
||||||
const { anonymousMode } = useAnonModeStore();
|
const { anonymousMode } = useAnonModeStore();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -14,6 +14,12 @@ const useAnonMode = (threadCid, execute) => {
|
|||||||
|
|
||||||
if (!storedAccounts[threadCid] && execute) {
|
if (!storedAccounts[threadCid] && execute) {
|
||||||
await createAccount();
|
await createAccount();
|
||||||
|
|
||||||
|
if(accounts.length === 0) {
|
||||||
|
console.log("No accounts available");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const lastAccount = accounts[accounts.length - 1];
|
const lastAccount = accounts[accounts.length - 1];
|
||||||
await setActiveAccount(lastAccount.name);
|
await setActiveAccount(lastAccount.name);
|
||||||
storedAccounts[threadCid] = lastAccount.name;
|
storedAccounts[threadCid] = lastAccount.name;
|
||||||
|
|||||||
Reference in New Issue
Block a user