Adding a protected user management page
In this section, we’ll define a user management page for users with the admin
role that displays the application’s registered users. Let’s start by defining the user module API service.
Defining a user API Redux slice using Redux Toolkit’s createApi function
We’ll begin by creating a users
directory beneath the src
folder, where we’ll create all of the user management-related services and components. Next, we’ll create a new api.js
file where we’ll implement the required functionality. The following snippet contains the most relevant part of the code (you can find the complete code in this book’s GitHub repository at https://github.com/PacktPublishing/Full-Stack-Development-with-Quarkus-and-React/tree/main/chapter-08/src/main/frontend/src/users/api.js):
export const api = createApi({
reducerPath: 'users',
baseQuery: authBaseQuery({path: ...