From 1c6cc0cc8a4ed6f0d40a3a38248aa0e4f1bbd440 Mon Sep 17 00:00:00 2001 From: juhanikat Date: Mon, 14 Jul 2025 12:30:13 +0300 Subject: [PATCH] fix useNotify() calls, and chnaged some typings --- .../src/components/CrossSearch/CrossSearchExportMenuItem.tsx | 2 +- frontend/src/components/DetailView/common/ContactForm.tsx | 2 +- frontend/src/components/Locality/LocalityDetails.tsx | 2 +- frontend/src/components/Locality/LocalityTable.tsx | 2 +- frontend/src/components/Login.tsx | 2 +- frontend/src/components/NavBar.tsx | 2 +- frontend/src/components/Person/PersonDetails.tsx | 2 +- frontend/src/components/Person/Tabs/AddUserModal.tsx | 2 +- frontend/src/components/Person/Tabs/ChangePasswordForm.tsx | 2 +- frontend/src/components/Person/Tabs/PersonTab.tsx | 2 +- frontend/src/components/Reference/ReferenceDetails.tsx | 2 +- frontend/src/components/Region/RegionDetails.tsx | 2 +- frontend/src/components/Species/SpeciesDetails.tsx | 2 +- frontend/src/components/TimeBound/TimeBoundDetails.tsx | 2 +- frontend/src/components/TimeUnit/TimeUnitDetails.tsx | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/CrossSearch/CrossSearchExportMenuItem.tsx b/frontend/src/components/CrossSearch/CrossSearchExportMenuItem.tsx index 60bc8eda..c395ccbd 100644 --- a/frontend/src/components/CrossSearch/CrossSearchExportMenuItem.tsx +++ b/frontend/src/components/CrossSearch/CrossSearchExportMenuItem.tsx @@ -28,7 +28,7 @@ export const CrossSearchExportMenuItem = ({ handleClose }: { handleClose: () => throw new Error('Server response was not OK.') } const reader = response.body!.getReader() - const file: Uint8Array[] = [] + const file: Uint8Array[] = [] let bytes = 0 let closed = false diff --git a/frontend/src/components/DetailView/common/ContactForm.tsx b/frontend/src/components/DetailView/common/ContactForm.tsx index 26dfe3e9..f39cdf3a 100755 --- a/frontend/src/components/DetailView/common/ContactForm.tsx +++ b/frontend/src/components/DetailView/common/ContactForm.tsx @@ -43,7 +43,7 @@ export const ContactForm = ({ const [sendEmailMutation] = useEmailMutation() const { trigger, getValues, register, setValue, control, formState } = useForm() const { errors } = formState - const notify = useNotify() + const { notify } = useNotify() const user = useUser() const { data: personData, isLoading: personQueryloading } = useGetPersonDetailsQuery(user.initials ?? skipToken) diff --git a/frontend/src/components/Locality/LocalityDetails.tsx b/frontend/src/components/Locality/LocalityDetails.tsx index 1ec7d95b..fe0505f2 100755 --- a/frontend/src/components/Locality/LocalityDetails.tsx +++ b/frontend/src/components/Locality/LocalityDetails.tsx @@ -35,7 +35,7 @@ export const LocalityDetails = () => { skip: isNew, }) - const notify = useNotify() + const { notify } = useNotify() const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteLocalityMutation() useEffect(() => { diff --git a/frontend/src/components/Locality/LocalityTable.tsx b/frontend/src/components/Locality/LocalityTable.tsx index 88654fbe..ed75d7e4 100755 --- a/frontend/src/components/Locality/LocalityTable.tsx +++ b/frontend/src/components/Locality/LocalityTable.tsx @@ -25,7 +25,7 @@ export const LocalityTable = ({ selectorFn }: { selectorFn?: (newObject: Localit const [getLocalitySpeciesList, { isLoading }] = useGetLocalitySpeciesListMutation() const [filteredLocalities, setFilteredLocalities] = useState() const columnFilters = usePageContext() - const notify = useNotify() + const { notify } = useNotify() const handleLocalityRowActionClick = (row: Locality) => { setSelectedLocality(row.lid.toString()) diff --git a/frontend/src/components/Login.tsx b/frontend/src/components/Login.tsx index 04dd7672..d5863d80 100755 --- a/frontend/src/components/Login.tsx +++ b/frontend/src/components/Login.tsx @@ -17,7 +17,7 @@ export const Login = () => { const location = useLocation() const search = new URLSearchParams(location.search) const loginHadExpired = search.get('expired') - const notify = useNotify() + const { notify } = useNotify() document.title = 'Login' diff --git a/frontend/src/components/NavBar.tsx b/frontend/src/components/NavBar.tsx index 02d7fe5f..c72f596e 100755 --- a/frontend/src/components/NavBar.tsx +++ b/frontend/src/components/NavBar.tsx @@ -16,7 +16,7 @@ export const NavBar = () => { const user = useUser() const navigate = useNavigate() const dispatch = useDispatch() - const notify = useNotify() + const { notify } = useNotify() const pages: LinkDefinition[] = [ { title: 'Localities', url: '/locality' }, { title: 'Species', url: '/species' }, diff --git a/frontend/src/components/Person/PersonDetails.tsx b/frontend/src/components/Person/PersonDetails.tsx index 56512c04..4b3c9f8f 100755 --- a/frontend/src/components/Person/PersonDetails.tsx +++ b/frontend/src/components/Person/PersonDetails.tsx @@ -18,7 +18,7 @@ export const PersonDetails = () => { const { id: idFromUrl } = useParams() const user = useUser() const [editPersonRequest, { isLoading: mutationLoading }] = useEditPersonMutation() - const notify = useNotify() + const { notify } = useNotify() const navigate = useNavigate() // A bit convoluted, but this is to allow using the same component for user's own page diff --git a/frontend/src/components/Person/Tabs/AddUserModal.tsx b/frontend/src/components/Person/Tabs/AddUserModal.tsx index 720b91eb..2bce279b 100644 --- a/frontend/src/components/Person/Tabs/AddUserModal.tsx +++ b/frontend/src/components/Person/Tabs/AddUserModal.tsx @@ -119,7 +119,7 @@ export const AddUserModal = ({ isOpen, onClose, onSave, personInitials }: Props) userGroup: userGroups[0], }) const [createUser, { isLoading }] = useCreateUserMutation() - const notify = useNotify() + const { notify } = useNotify() const save = () => { const userDetails: UserDetailsType = { diff --git a/frontend/src/components/Person/Tabs/ChangePasswordForm.tsx b/frontend/src/components/Person/Tabs/ChangePasswordForm.tsx index c07dbfb6..23056376 100755 --- a/frontend/src/components/Person/Tabs/ChangePasswordForm.tsx +++ b/frontend/src/components/Person/Tabs/ChangePasswordForm.tsx @@ -11,7 +11,7 @@ export const ChangePasswordForm = () => { const [newPassword, setNewPassword] = useState('') const [verifyPassword, setVerifyPassword] = useState('') const [changePasswordMutation] = useChangePasswordMutation() - const notify = useNotify() + const { notify } = useNotify() const sx = { display: 'flex', alignItems: 'center', width: '10em', fontWeight: 'bold' } const dispatch = useDispatch() diff --git a/frontend/src/components/Person/Tabs/PersonTab.tsx b/frontend/src/components/Person/Tabs/PersonTab.tsx index 8a041ee1..74ecb801 100755 --- a/frontend/src/components/Person/Tabs/PersonTab.tsx +++ b/frontend/src/components/Person/Tabs/PersonTab.tsx @@ -15,7 +15,7 @@ import { AddUserModal } from './AddUserModal' export const PersonTab = () => { const { textField, dropdownWithSearch, data, mode } = useDetailContext() const currentUser = useUser() - const notify = useNotify() + const { notify } = useNotify() const { id: idFromUrl } = useParams() const isNew = idFromUrl === 'new' const isAdmin = currentUser.role == Role.Admin diff --git a/frontend/src/components/Reference/ReferenceDetails.tsx b/frontend/src/components/Reference/ReferenceDetails.tsx index 70a07f71..5f655d06 100755 --- a/frontend/src/components/Reference/ReferenceDetails.tsx +++ b/frontend/src/components/Reference/ReferenceDetails.tsx @@ -24,7 +24,7 @@ export const ReferenceDetails = () => { const { isFetching, isError, data } = useGetReferenceDetailsQuery(id!, { skip: isNew }) const [editReferenceRequest, { isLoading: mutationLoading }] = useEditReferenceMutation() const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteReferenceMutation() - const notify = useNotify() + const { notify } = useNotify() const navigate = useNavigate() useEffect(() => { diff --git a/frontend/src/components/Region/RegionDetails.tsx b/frontend/src/components/Region/RegionDetails.tsx index e8883f10..ae8fd4ab 100755 --- a/frontend/src/components/Region/RegionDetails.tsx +++ b/frontend/src/components/Region/RegionDetails.tsx @@ -15,7 +15,7 @@ export const RegionDetails = () => { const { isLoading, isError, data } = useGetRegionDetailsQuery(id!, { skip: isNew }) const [editRegionRequest, { isLoading: mutationLoading }] = useEditRegionMutation() const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteRegionMutation() - const notify = useNotify() + const { notify } = useNotify() const navigate = useNavigate() useEffect(() => { diff --git a/frontend/src/components/Species/SpeciesDetails.tsx b/frontend/src/components/Species/SpeciesDetails.tsx index 600da64c..5e3089f2 100755 --- a/frontend/src/components/Species/SpeciesDetails.tsx +++ b/frontend/src/components/Species/SpeciesDetails.tsx @@ -25,7 +25,7 @@ export const SpeciesDetails = () => { } const [editSpeciesRequest, { isLoading: mutationLoading }] = useEditSpeciesMutation() const { isError, isFetching, data } = useGetSpeciesDetailsQuery(id!, { skip: isNew }) - const notify = useNotify() + const { notify } = useNotify() const navigate = useNavigate() const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteSpeciesMutation() diff --git a/frontend/src/components/TimeBound/TimeBoundDetails.tsx b/frontend/src/components/TimeBound/TimeBoundDetails.tsx index c5867984..3c956c79 100755 --- a/frontend/src/components/TimeBound/TimeBoundDetails.tsx +++ b/frontend/src/components/TimeBound/TimeBoundDetails.tsx @@ -26,7 +26,7 @@ export const TimeBoundDetails = () => { }) const [editTimeBoundRequest] = useEditTimeBoundMutation() - const notify = useNotify() + const { notify } = useNotify() const navigate = useNavigate() const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteTimeBoundMutation() diff --git a/frontend/src/components/TimeUnit/TimeUnitDetails.tsx b/frontend/src/components/TimeUnit/TimeUnitDetails.tsx index e8873b40..c9f1d976 100755 --- a/frontend/src/components/TimeUnit/TimeUnitDetails.tsx +++ b/frontend/src/components/TimeUnit/TimeUnitDetails.tsx @@ -25,7 +25,7 @@ export const TimeUnitDetails = () => { const { isLoading, isError, isFetching, data } = useGetTimeUnitDetailsQuery(encodeURIComponent(id!), { skip: isNew }) const [editTimeUnitRequest] = useEditTimeUnitMutation() - const notify = useNotify() + const { notify } = useNotify() const navigate = useNavigate() const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteTimeUnitMutation()