feat(AdminPage): add support for UserInputType in handleNewUser function to improve type safety and prevent potential errors
fix(UserInputType): make is_active and is_superuser optional in UserInputType to allow for flexibility in user input
This commit is contained in:
parent
19c1eb6cf6
commit
85add46761
2 changed files with 4 additions and 3 deletions
|
|
@ -25,6 +25,7 @@ import {
|
|||
} from "../../controllers/API";
|
||||
import ConfirmationModal from "../../modals/ConfirmationModal";
|
||||
import UserManagementModal from "../../modals/UserManagementModal";
|
||||
import { UserInputType } from "../../types/components";
|
||||
|
||||
export default function AdminPage() {
|
||||
const [inputValue, setInputValue] = useState("");
|
||||
|
|
@ -164,7 +165,7 @@ export default function AdminPage() {
|
|||
});
|
||||
}
|
||||
|
||||
function handleNewUser(user) {
|
||||
function handleNewUser(user: UserInputType) {
|
||||
addUser(user)
|
||||
.then((res) => {
|
||||
resetFilter();
|
||||
|
|
|
|||
|
|
@ -230,6 +230,6 @@ export type loginInputStateType = {
|
|||
export type UserInputType = {
|
||||
username: string;
|
||||
password: string;
|
||||
is_active: boolean;
|
||||
is_superuser: boolean;
|
||||
is_active?: boolean;
|
||||
is_superuser?: boolean;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue