2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 11:36:44 +00:00

[UI] Enhanced null checks (#8706) (#8711)

* Extra null check in SettingList.tsx

* Null checks on error responses

(cherry picked from commit 378d69f0b36db3a35b65857a10cf9f56f64eda85)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot] 2024-12-19 01:01:51 +11:00 committed by GitHub
parent 6bd32c9236
commit e37ff5c3d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -202,7 +202,7 @@ export function RegistrationForm() {
}
})
.catch((err) => {
if (err.response.status === 400) {
if (err.response?.status === 400) {
setIsRegistering(false);
for (const [key, value] of Object.entries(err.response.data)) {
registrationForm.setFieldError(key, value as string);

View File

@ -158,7 +158,7 @@ export function SettingList({
</React.Fragment>
);
})}
{(keys || allKeys).length === 0 && (
{(keys || allKeys)?.length === 0 && (
<Text style={{ fontStyle: 'italic' }}>
<Trans>No settings specified</Trans>
</Text>

View File

@ -77,8 +77,8 @@ export default function Set_Password() {
})
.catch((err) => {
if (
err.response.status === 400 &&
err.response.data?.token == 'Invalid value'
err.response?.status === 400 &&
err.response?.data?.token == 'Invalid value'
) {
invalidToken();
} else {