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

[UI] Enhanced null checks (#8706)

* Extra null check in SettingList.tsx

* Null checks on error responses
This commit is contained in:
Oliver 2024-12-19 00:59:56 +11:00 committed by GitHub
parent 1eaf3a4594
commit 378d69f0b3
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) => { .catch((err) => {
if (err.response.status === 400) { if (err.response?.status === 400) {
setIsRegistering(false); setIsRegistering(false);
for (const [key, value] of Object.entries(err.response.data)) { for (const [key, value] of Object.entries(err.response.data)) {
registrationForm.setFieldError(key, value as string); registrationForm.setFieldError(key, value as string);

View File

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

View File

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