Skip to content
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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

carlahauu
Copy link
Collaborator

image

@@ -10,9 +10,20 @@ import { STATUSES } from "@/data/admin/Admins";

const Admin = () => {
const { data: session } = useSession();

function extractFirstName(str) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. arrow function
  2. put this as a util and have 1 function return both the first and last name and use that everywhere

const [lead, setLead] = useState({
...ATTRIBUTES,
name: session.user.name,
roles: session.user.roles,
firstName: extractFirstName(session.user.name),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call the variables just first and last

function extractLastName(str) {
return str.trim().split(" ")[1];
}

const [volunteer, setVolunteer] = useState({
Copy link
Contributor

Choose a reason for hiding this comment

The 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split into First Name and Last Name
2 participants