Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/components/Admin/AddUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const AddUser: React.FC<AddUserProps> = ({ isOpen, onClose }) => {
onClose()
},
onError: (err: ApiError) => {
const errDetail = err.body.detail
const errDetail = err.body?.detail
showToast('Something went wrong.', `${errDetail}`, 'error')
},
onSettled: () => {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Admin/EditUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const EditUser: React.FC<EditUserProps> = ({ user, isOpen, onClose }) => {
onClose()
},
onError: (err: ApiError) => {
const errDetail = err.body.detail
const errDetail = err.body?.detail
showToast('Something went wrong.', `${errDetail}`, 'error')
},
onSettled: () => {
Expand All @@ -67,7 +67,7 @@ const EditUser: React.FC<EditUserProps> = ({ user, isOpen, onClose }) => {

const onSubmit: SubmitHandler<UserUpdateForm> = async (data) => {
if (data.password === '') {
delete data.password
data.password = undefined
}
mutation.mutate(data)
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Common/ActionsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ActionsMenu: React.FC<ActionsMenuProps> = ({ type, value, disabled }) => {
as={Button}
rightIcon={<BsThreeDotsVertical />}
variant="unstyled"
></MenuButton>
/>
<MenuList>
<MenuItem
onClick={editUserModal.onOpen}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Items/AddItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const AddItem: React.FC<AddItemProps> = ({ isOpen, onClose }) => {
onClose()
},
onError: (err: ApiError) => {
const errDetail = err.body.detail
const errDetail = err.body?.detail
showToast('Something went wrong.', `${errDetail}`, 'error')
},
onSettled: () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Items/EditItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const EditItem: React.FC<EditItemProps> = ({ item, isOpen, onClose }) => {
onClose()
},
onError: (err: ApiError) => {
const errDetail = err.body.detail
const errDetail = err.body?.detail
showToast('Something went wrong.', `${errDetail}`, 'error')
},
onSettled: () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/UserSettings/ChangePassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const ChangePassword: React.FC = () => {
reset()
},
onError: (err: ApiError) => {
const errDetail = err.body.detail
const errDetail = err.body?.detail
showToast('Something went wrong.', `${errDetail}`, 'error')
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const DeleteConfirmation: React.FC<DeleteProps> = ({ isOpen, onClose }) => {
onClose()
},
onError: (err: ApiError) => {
const errDetail = err.body.detail
const errDetail = err.body?.detail
showToast('Something went wrong.', `${errDetail}`, 'error')
},
onSettled: () => {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/UserSettings/UserInformation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const UserInformation: React.FC = () => {
showToast('Success!', 'User updated successfully.', 'success')
},
onError: (err: ApiError) => {
const errDetail = err.body.detail
const errDetail = err.body?.detail
showToast('Something went wrong.', `${errDetail}`, 'error')
},
onSettled: () => {
Expand Down Expand Up @@ -118,7 +118,7 @@ const UserInformation: React.FC = () => {
/>
) : (
<Text size="md" py={2}>
{currentUser!.email}
{currentUser?.email}
</Text>
)}
{errors.email && (
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/routes/reset-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ function ResetPassword() {

const resetPassword = async (data: NewPassword) => {
const token = new URLSearchParams(window.location.search).get('token')
if (!token) return
await LoginService.resetPassword({
requestBody: { new_password: data.new_password, token: token! },
requestBody: { new_password: data.new_password, token: token },
})
}

Expand All @@ -62,7 +63,7 @@ function ResetPassword() {
navigate({ to: '/login' })
},
onError: (err: ApiError) => {
const errDetail = err.body.detail
const errDetail = err.body?.detail
showToast('Something went wrong.', `${errDetail}`, 'error')
},
})
Expand Down