fix(users.py): update error message to be more generic and not reveal specific reason for username unavailability
fix(AdminPage/index.tsx): fix nullish assertion for create_at and updated_at properties to avoid potential errors fix(signUpPage/index.tsx): fix error handling to correctly display error message fix(types/components/index.ts): make id, create_at, and updated_at properties optional in UserInputType
This commit is contained in:
parent
d73b3b0b52
commit
cf8df6c62b
4 changed files with 7 additions and 7 deletions
|
|
@ -43,7 +43,7 @@ def add_user(
|
||||||
db.refresh(new_user)
|
db.refresh(new_user)
|
||||||
except IntegrityError as e:
|
except IntegrityError as e:
|
||||||
db.rollback()
|
db.rollback()
|
||||||
raise HTTPException(status_code=400, detail="This username is unavailable as it has already been claimed. Please choose a different username.") from e
|
raise HTTPException(status_code=400, detail="This username is unavailable.") from e
|
||||||
|
|
||||||
return new_user
|
return new_user
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -348,14 +348,14 @@ export default function AdminPage() {
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="truncate py-2 ">
|
<TableCell className="truncate py-2 ">
|
||||||
{
|
{
|
||||||
new Date(user.create_at)
|
new Date(user.create_at!)
|
||||||
.toISOString()
|
.toISOString()
|
||||||
.split("T")[0]
|
.split("T")[0]
|
||||||
}
|
}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="truncate py-2">
|
<TableCell className="truncate py-2">
|
||||||
{
|
{
|
||||||
new Date(user.updated_at)
|
new Date(user.updated_at!)
|
||||||
.toISOString()
|
.toISOString()
|
||||||
.split("T")[0]
|
.split("T")[0]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ export default function SignUp(): JSX.Element {
|
||||||
} = error;
|
} = error;
|
||||||
setErrorData({
|
setErrorData({
|
||||||
title: "Error signing up",
|
title: "Error signing up",
|
||||||
list: [detail[0].msg],
|
list: [detail],
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -266,9 +266,9 @@ export type UserInputType = {
|
||||||
password: string;
|
password: string;
|
||||||
is_active?: boolean;
|
is_active?: boolean;
|
||||||
is_superuser?: boolean;
|
is_superuser?: boolean;
|
||||||
id: string;
|
id?: string;
|
||||||
create_at: string;
|
create_at?: string;
|
||||||
updated_at:string;
|
updated_at?:string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ApiKeyType = {
|
export type ApiKeyType = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue