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";
|
} from "../../controllers/API";
|
||||||
import ConfirmationModal from "../../modals/ConfirmationModal";
|
import ConfirmationModal from "../../modals/ConfirmationModal";
|
||||||
import UserManagementModal from "../../modals/UserManagementModal";
|
import UserManagementModal from "../../modals/UserManagementModal";
|
||||||
|
import { UserInputType } from "../../types/components";
|
||||||
|
|
||||||
export default function AdminPage() {
|
export default function AdminPage() {
|
||||||
const [inputValue, setInputValue] = useState("");
|
const [inputValue, setInputValue] = useState("");
|
||||||
|
|
@ -164,7 +165,7 @@ export default function AdminPage() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleNewUser(user) {
|
function handleNewUser(user: UserInputType) {
|
||||||
addUser(user)
|
addUser(user)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
resetFilter();
|
resetFilter();
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,6 @@ export type loginInputStateType = {
|
||||||
export type UserInputType = {
|
export type UserInputType = {
|
||||||
username: string;
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
is_active: boolean;
|
is_active?: boolean;
|
||||||
is_superuser: boolean;
|
is_superuser?: boolean;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue