Skip to content

Commit

Permalink
Fixed messages
Browse files Browse the repository at this point in the history
  • Loading branch information
alantao912 committed Nov 20, 2023
1 parent 3a6474b commit cfe708a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions frontend/src/common/redux/userLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,30 @@ export const registerViaEmailAndPassword = createAsyncThunk<
});
}

if (!firstName || firstName === "" || !isNameValid(firstName)) {
if (!firstName || firstName === "") {
return thunkAPI.rejectWithValue({
message: "Please enter your first name"
});
}

if (!lastName || lastName === "" || !isNameValid(lastName)) {
if (!isNameValid(firstName)) {
return thunkAPI.rejectWithValue({
message: "First name must contain only letters"
});
}

if (!lastName || lastName === "") {
return thunkAPI.rejectWithValue({
message: "Please enter your last name"
});
}

if (!isNameValid(lastName)) {
return thunkAPI.rejectWithValue({
message: "Last name must contain only letters"
});
}

try {
const userCredential = await createUserWithEmailAndPassword(
auth,
Expand Down

0 comments on commit cfe708a

Please sign in to comment.