Open chavda-bhavik opened 2 months ago
I think this can solve the problem with the name and surname:
/**
* Name formater to capitalize the first letter
* @param name string to capitalize
* @returns a string with the name with capital letter at char position 0
*/
const formatName = (name: string): string => {
if (!name) return '';
return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
};
/**
* Now we can send the info in the right format to the back end
*/
const onSignup = (data: ISignupFormData) => {
const nameParts = data.fullName.trim().split(' ');// We save the name parts as an array with the fristName and the lastName
const firstName = formatName(nameParts[0]);
const lastName = nameParts.length > 1 ? formatName(nameParts.slice(1).join(' ')) : '';
const signupData: ISignupData = {
firstName: firstName,
lastName: lastName,
email: data.email,
password: data.password,
};
signup(signupData);
};
@JotaceCode Looking awesome. Would you like to create a merge request for it? Thanks for taking a look.
@JotaceCode I can assign this issue to you if you like.
Ok let me do the pr!
Is your feature request related to a problem? Please describe. If the user signs up, his/her first and last name should have the first letter in uppercase and other letters should be in lowercase.
Describe the solution you'd like We can do an update in the signup form to send the formatted name in the backend.