From 5e7057176a219e7a2949d84f2df4a927ce5354a2 Mon Sep 17 00:00:00 2001 From: Timothy Le Bon Date: Thu, 9 Nov 2023 17:05:41 +0100 Subject: [PATCH] fix: remove form param submission bug --- src/script/auth/component/JoinGuestLinkPasswordModal.tsx | 7 ++++--- src/script/auth/module/action/ConversationAction.ts | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/script/auth/component/JoinGuestLinkPasswordModal.tsx b/src/script/auth/component/JoinGuestLinkPasswordModal.tsx index 425a1556abf..92418e0c90c 100644 --- a/src/script/auth/component/JoinGuestLinkPasswordModal.tsx +++ b/src/script/auth/component/JoinGuestLinkPasswordModal.tsx @@ -45,7 +45,8 @@ const JoinGuestLinkPasswordModal: React.FC = ({ const {formatMessage: _} = useIntl(); const [passwordValue, setPasswordValue] = useState(''); - const onSubmit = () => { + const onSubmit = (event: React.FormEvent) => { + event.preventDefault(); onSubmitPassword(passwordValue); }; @@ -70,7 +71,7 @@ const JoinGuestLinkPasswordModal: React.FC = ({
) => onSubmit(event)} autoComplete="off" > = ({ block type="button" disabled={!passwordValue} - onClick={onSubmit} + onClick={(event: React.FormEvent) => onSubmit(event)} data-uie-name="guest-link-join-submit-button" > {_(joinGuestLinkPasswordModalStrings.joinConversation)} diff --git a/src/script/auth/module/action/ConversationAction.ts b/src/script/auth/module/action/ConversationAction.ts index bcf8b9865da..1a6b5cf1adc 100644 --- a/src/script/auth/module/action/ConversationAction.ts +++ b/src/script/auth/module/action/ConversationAction.ts @@ -46,7 +46,7 @@ export class ConversationAction { code: string, uri?: string, password?: string, - ): ThunkAction> => { + ): ThunkAction> => { return async (dispatch, getState, {apiClient}) => { dispatch(ConversationActionCreator.startJoinConversationByCode()); try { @@ -66,7 +66,7 @@ export class ConversationAction { has_password: true, } as ConversationJoinData), ); - return undefined; + throw error; } dispatch(ConversationActionCreator.failedJoinConversationByCode(error)); throw error;