-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split name into first and last name #1563
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,21 @@ import { STATUSES } from "@/data/admin/Leads"; | |
|
||
const Lead = () => { | ||
const { data: session } = useSession(); | ||
function extractFirstName(str) { | ||
return str.trim().split(" ")[0]; | ||
} | ||
|
||
function extractLastName(str) { | ||
return str.trim().split(" ")[1]; | ||
} | ||
|
||
const [lead, setLead] = useState({ | ||
...ATTRIBUTES, | ||
name: session.user.name, | ||
roles: session.user.roles, | ||
firstName: extractFirstName(session.user.name), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. call the variables just first and last |
||
lastName: extractLastName(session.user.name), | ||
email: session.user.email, | ||
roles: session.user.roles, | ||
form: "leads", | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,19 @@ import { STATUSES } from "@/data/admin/Volunteers.js"; | |
const Volunteer = () => { | ||
const { data: session } = useSession(); | ||
|
||
function extractFirstName(str) { | ||
return str.trim().split(" ")[0]; | ||
} | ||
|
||
function extractLastName(str) { | ||
return str.trim().split(" ")[1]; | ||
} | ||
|
||
const [volunteer, setVolunteer] = useState({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for each form, when we submit, we need to remove the first and last separate and merge it back into just name so the DB remains the same |
||
...ATTRIBUTES, | ||
name: session.user.name, | ||
firstName: extractFirstName(session.user.name), | ||
lastName: extractLastName(session.user.name), | ||
email: session.user.email, | ||
roles: session.user.roles, | ||
form: "volunteers", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.