Skip to content

Commit

Permalink
fix: remove form param submission bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tlebon committed Nov 9, 2023
1 parent 0c84609 commit 5e70571
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/script/auth/component/JoinGuestLinkPasswordModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const JoinGuestLinkPasswordModal: React.FC<JoinGuestLinkPasswordModalProps> = ({
const {formatMessage: _} = useIntl();
const [passwordValue, setPasswordValue] = useState<string>('');

const onSubmit = () => {
const onSubmit = (event: React.FormEvent<HTMLFormElement | HTMLButtonElement>) => {
event.preventDefault();
onSubmitPassword(passwordValue);
};

Expand All @@ -70,7 +71,7 @@ const JoinGuestLinkPasswordModal: React.FC<JoinGuestLinkPasswordModalProps> = ({
<Form
name="guest-password-join-form"
data-uie-name="guest-password-join-form"
onSubmit={onSubmit}
onSubmit={(event: React.FormEvent<HTMLFormElement>) => onSubmit(event)}
autoComplete="off"
>
<Input
Expand Down Expand Up @@ -98,7 +99,7 @@ const JoinGuestLinkPasswordModal: React.FC<JoinGuestLinkPasswordModalProps> = ({
block
type="button"
disabled={!passwordValue}
onClick={onSubmit}
onClick={(event: React.FormEvent<HTMLButtonElement>) => onSubmit(event)}
data-uie-name="guest-link-join-submit-button"
>
{_(joinGuestLinkPasswordModalStrings.joinConversation)}
Expand Down
4 changes: 2 additions & 2 deletions src/script/auth/module/action/ConversationAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class ConversationAction {
code: string,
uri?: string,
password?: string,
): ThunkAction<Promise<ConversationEvent | undefined>> => {
): ThunkAction<Promise<ConversationEvent>> => {
return async (dispatch, getState, {apiClient}) => {
dispatch(ConversationActionCreator.startJoinConversationByCode());
try {
Expand All @@ -66,7 +66,7 @@ export class ConversationAction {
has_password: true,
} as ConversationJoinData),
);
return undefined;
throw error;
}
dispatch(ConversationActionCreator.failedJoinConversationByCode(error));
throw error;
Expand Down

0 comments on commit 5e70571

Please sign in to comment.