Skip to content

Commit

Permalink
[UI] Enhanced null checks (#8706)
Browse files Browse the repository at this point in the history
* Extra null check in SettingList.tsx

* Null checks on error responses
  • Loading branch information
SchrodingersGat authored Dec 18, 2024
1 parent 1eaf3a4 commit 378d69f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/frontend/src/components/forms/AuthenticationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/components/settings/SettingList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/pages/Auth/Set-Password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 378d69f

Please sign in to comment.