fix signer when anon mode is off

This commit is contained in:
Tom (plebeius.eth)
2024-08-07 16:25:53 +02:00
parent 82ae926180
commit 6fe0157efc
2 changed files with 16 additions and 9 deletions
+9 -5
View File
@@ -28,7 +28,7 @@ import useAnonMode from '../../hooks/use-anon-mode';
type SubmitState = {
author: any | undefined;
signer: any | undefined;
signer?: any | undefined;
subplebbitAddress: string | undefined;
title: string | undefined;
content: string | undefined;
@@ -61,9 +61,8 @@ const useSubmitStore = create<SubmitState>((set) => ({
if (link !== undefined) nextState.link = link || undefined;
if (spoiler !== undefined) nextState.spoiler = spoiler || undefined;
nextState.publishCommentOptions = {
const publishCommentOptions: PublishCommentOptions = {
author: nextState.author,
signer: nextState.signer,
subplebbitAddress: nextState.subplebbitAddress,
title: nextState.title,
content: nextState.content,
@@ -73,10 +72,15 @@ const useSubmitStore = create<SubmitState>((set) => ({
onChallengeVerification: alertChallengeVerificationFailed,
onError: (error: Error) => {
console.error(error);
let errorMessage = error.message;
alert(errorMessage);
alert(error.message);
},
};
if (nextState.signer) {
publishCommentOptions.signer = nextState.signer;
}
nextState.publishCommentOptions = publishCommentOptions;
return nextState;
}),
resetSubmitStore: () =>