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

Approve reject super status admin #75

Merged
merged 27 commits into from
Oct 10, 2019
Merged

Conversation

dupreesi
Copy link
Collaborator

@dupreesi dupreesi commented Oct 4, 2019

relates to #77, #76, #7

ADMIN USER CAN APPROVE / REJECT SUPER USER AND USER VERIFICATIONS

  • creates feature to approve or reject users awaiting verification and/or awaiting super user status
  • adds queries to approve, reject super users / users
  • adds handler that deals with onClick requests to approve/ reject
  • restructures Admin/User component structure to clean up User/index.js router
  • filters user data according to various sections
  • adds custom hook: hooks/postPatchPut.js to be used for api calls (example usage in Admin/Users/AllUsers.js as patch request)

to test rebuild db, go to Admin/Users/AllUsers.js and modify

const admin = 'hardcoded admin user id'

then go to admin control panel and hit users...

Copy link
Contributor

@arrested-developer arrested-developer left a comment

Choose a reason for hiding this comment

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

Looks great!

The test warns of a deprecation in Mongoose, which can be resolved by adding

useFindAndModify: false

to the config options in dbConnection.js

Also...

When I change the admin string in the component to a made up value, the API returns 500 error, but it would make more sense to get a 400 or 403 as the admin ID passed is invalid - is it possible to add some error handling for this?

Simon Dupree added 2 commits October 5, 2019 09:31
@arrested-developer
Copy link
Contributor

I've refactored usePostPatchPut into useApiCallback, as what it really allows us to do is create a callback to be used one or more times that makes an API call and then updates state. The method you choose to use is not important to the hook, and it will allow you to use any method, including GET, with or without a data payload.

This allows the hook to be used more or less as it is, without having to create more local state to store it in.

@amusameh amusameh merged commit f63c34f into master Oct 10, 2019
arrested-developer added a commit that referenced this pull request Oct 10, 2019
@arrested-developer arrested-developer deleted the approve-reject-superStatus-admin branch October 10, 2019 15:17
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.

3 participants