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

Add functionality to the Basic Settings #2644

Merged
merged 2 commits into from
Dec 25, 2022

Conversation

flacial
Copy link
Member

@flacial flacial commented Dec 24, 2022

Problem

After adding the UI for the user settings page Basic Settings section, we didn't add the functionality for updating the user's username and full name to ensure the PR is easy to review.

Solution

Import and use the hook for updating the user's username and full name in the client.

  const onClick = async () => {
      // ...
      await updateUserNames({
        variables: {
          username: options[0].value as string,
          name: `${options[1].value} ${options[2].value}`
        }
      })
      // ...
  }

Steps taken

  1. Imported the hook useUpdateUserNames
  2. Added the methods for error-checking the inputs
  3. Displayed the state of the updating the names whether it was successful or loading.
  4. Call useUpdateUserNames callback function when the user tries to save the changes
  5. Ensured everything is working correctly by covering more cases in the page's test file

Testing instructions

  1. Login with leetcoder or newbie to not mess up the admin account
  2. Go to /settings/account
  3. Change one/all the inputs
  4. Hit Save changes
  5. Notice that the username/name got changed

Related issues

@vercel
Copy link

vercel bot commented Dec 24, 2022

@flacial is attempting to deploy a commit to the c0d3-prod Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Dec 24, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
c0d3-app ✅ Ready (Inspect) Visit Preview Dec 24, 2022 at 6:41PM (UTC)

@codecov
Copy link

codecov bot commented Dec 24, 2022

Codecov Report

Merging #2644 (dd7bb05) into master (d8a1aca) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #2644   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          189       189           
  Lines         3457      3473   +16     
  Branches       958       960    +2     
=========================================
+ Hits          3457      3473   +16     
Impacted Files Coverage Δ
helpers/formValidation.tsx 100.00% <100.00%> (ø)
pages/settings/account/index.tsx 100.00% <100.00%> (ø)

@flacial flacial merged commit e783e37 into garageScript:master Dec 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants