Skip to content

Commit

Permalink
Merge pull request #28 from Cyggnus/lkotlarenko-hotfix
Browse files Browse the repository at this point in the history
fix: 🐛 format username correctly
  • Loading branch information
lkotlarenko authored Aug 13, 2023
2 parents 03f06d6 + f455012 commit 5da7b8b
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/Components/SyncForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,19 @@ const SyncPage: React.FC = () => {
};

const handleSubmit = (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();
const userInputElement = event.currentTarget.elements.namedItem(
'username'
) as HTMLInputElement;
let userFromEvent = userInputElement.value.trim();
if (!userFromEvent) userFromEvent = 'DefaultPool2';
backToTopAction();
handleChangeUser(userFromEvent);
};
event.preventDefault();
const userInputElement = event.currentTarget.elements.namedItem(
'username'
) as HTMLInputElement;

let userFromEvent = userInputElement.value;
if (!userFromEvent) userFromEvent = 'DefaultPool2';

const formattedUser = userFromEvent.replace(/\s+/g, '-');

backToTopAction();
handleChangeUser(formattedUser);
};

const handleInputFocus = () => {
setIsInputFocused(true);
Expand Down

0 comments on commit 5da7b8b

Please sign in to comment.