mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
fix useNotify() calls, and chnaged some typings
This commit is contained in:
@@ -28,7 +28,7 @@ export const CrossSearchExportMenuItem = ({ handleClose }: { handleClose: () =>
|
|||||||
throw new Error('Server response was not OK.')
|
throw new Error('Server response was not OK.')
|
||||||
}
|
}
|
||||||
const reader = response.body!.getReader()
|
const reader = response.body!.getReader()
|
||||||
const file: Uint8Array<ArrayBufferLike>[] = []
|
const file: Uint8Array[] = []
|
||||||
let bytes = 0
|
let bytes = 0
|
||||||
let closed = false
|
let closed = false
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const ContactForm = <T extends object>({
|
|||||||
const [sendEmailMutation] = useEmailMutation()
|
const [sendEmailMutation] = useEmailMutation()
|
||||||
const { trigger, getValues, register, setValue, control, formState } = useForm<ContactFormValues>()
|
const { trigger, getValues, register, setValue, control, formState } = useForm<ContactFormValues>()
|
||||||
const { errors } = formState
|
const { errors } = formState
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
const { data: personData, isLoading: personQueryloading } = useGetPersonDetailsQuery(user.initials ?? skipToken)
|
const { data: personData, isLoading: personQueryloading } = useGetPersonDetailsQuery(user.initials ?? skipToken)
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export const LocalityDetails = () => {
|
|||||||
skip: isNew,
|
skip: isNew,
|
||||||
})
|
})
|
||||||
|
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteLocalityMutation()
|
const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteLocalityMutation()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const LocalityTable = ({ selectorFn }: { selectorFn?: (newObject: Localit
|
|||||||
const [getLocalitySpeciesList, { isLoading }] = useGetLocalitySpeciesListMutation()
|
const [getLocalitySpeciesList, { isLoading }] = useGetLocalitySpeciesListMutation()
|
||||||
const [filteredLocalities, setFilteredLocalities] = useState<SimplifiedLocality[]>()
|
const [filteredLocalities, setFilteredLocalities] = useState<SimplifiedLocality[]>()
|
||||||
const columnFilters = usePageContext()
|
const columnFilters = usePageContext()
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
|
|
||||||
const handleLocalityRowActionClick = (row: Locality) => {
|
const handleLocalityRowActionClick = (row: Locality) => {
|
||||||
setSelectedLocality(row.lid.toString())
|
setSelectedLocality(row.lid.toString())
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export const Login = () => {
|
|||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const search = new URLSearchParams(location.search)
|
const search = new URLSearchParams(location.search)
|
||||||
const loginHadExpired = search.get('expired')
|
const loginHadExpired = search.get('expired')
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
|
|
||||||
document.title = 'Login'
|
document.title = 'Login'
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export const NavBar = () => {
|
|||||||
const user = useUser()
|
const user = useUser()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
const pages: LinkDefinition[] = [
|
const pages: LinkDefinition[] = [
|
||||||
{ title: 'Localities', url: '/locality' },
|
{ title: 'Localities', url: '/locality' },
|
||||||
{ title: 'Species', url: '/species' },
|
{ title: 'Species', url: '/species' },
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export const PersonDetails = () => {
|
|||||||
const { id: idFromUrl } = useParams()
|
const { id: idFromUrl } = useParams()
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
const [editPersonRequest, { isLoading: mutationLoading }] = useEditPersonMutation()
|
const [editPersonRequest, { isLoading: mutationLoading }] = useEditPersonMutation()
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
// A bit convoluted, but this is to allow using the same component for user's own page
|
// A bit convoluted, but this is to allow using the same component for user's own page
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ export const AddUserModal = ({ isOpen, onClose, onSave, personInitials }: Props)
|
|||||||
userGroup: userGroups[0],
|
userGroup: userGroups[0],
|
||||||
})
|
})
|
||||||
const [createUser, { isLoading }] = useCreateUserMutation()
|
const [createUser, { isLoading }] = useCreateUserMutation()
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
|
|
||||||
const save = () => {
|
const save = () => {
|
||||||
const userDetails: UserDetailsType = {
|
const userDetails: UserDetailsType = {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const ChangePasswordForm = () => {
|
|||||||
const [newPassword, setNewPassword] = useState('')
|
const [newPassword, setNewPassword] = useState('')
|
||||||
const [verifyPassword, setVerifyPassword] = useState('')
|
const [verifyPassword, setVerifyPassword] = useState('')
|
||||||
const [changePasswordMutation] = useChangePasswordMutation()
|
const [changePasswordMutation] = useChangePasswordMutation()
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
const sx = { display: 'flex', alignItems: 'center', width: '10em', fontWeight: 'bold' }
|
const sx = { display: 'flex', alignItems: 'center', width: '10em', fontWeight: 'bold' }
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { AddUserModal } from './AddUserModal'
|
|||||||
export const PersonTab = () => {
|
export const PersonTab = () => {
|
||||||
const { textField, dropdownWithSearch, data, mode } = useDetailContext<PersonDetailsType>()
|
const { textField, dropdownWithSearch, data, mode } = useDetailContext<PersonDetailsType>()
|
||||||
const currentUser = useUser()
|
const currentUser = useUser()
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
const { id: idFromUrl } = useParams()
|
const { id: idFromUrl } = useParams()
|
||||||
const isNew = idFromUrl === 'new'
|
const isNew = idFromUrl === 'new'
|
||||||
const isAdmin = currentUser.role == Role.Admin
|
const isAdmin = currentUser.role == Role.Admin
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const ReferenceDetails = () => {
|
|||||||
const { isFetching, isError, data } = useGetReferenceDetailsQuery(id!, { skip: isNew })
|
const { isFetching, isError, data } = useGetReferenceDetailsQuery(id!, { skip: isNew })
|
||||||
const [editReferenceRequest, { isLoading: mutationLoading }] = useEditReferenceMutation()
|
const [editReferenceRequest, { isLoading: mutationLoading }] = useEditReferenceMutation()
|
||||||
const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteReferenceMutation()
|
const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteReferenceMutation()
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export const RegionDetails = () => {
|
|||||||
const { isLoading, isError, data } = useGetRegionDetailsQuery(id!, { skip: isNew })
|
const { isLoading, isError, data } = useGetRegionDetailsQuery(id!, { skip: isNew })
|
||||||
const [editRegionRequest, { isLoading: mutationLoading }] = useEditRegionMutation()
|
const [editRegionRequest, { isLoading: mutationLoading }] = useEditRegionMutation()
|
||||||
const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteRegionMutation()
|
const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteRegionMutation()
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const SpeciesDetails = () => {
|
|||||||
}
|
}
|
||||||
const [editSpeciesRequest, { isLoading: mutationLoading }] = useEditSpeciesMutation()
|
const [editSpeciesRequest, { isLoading: mutationLoading }] = useEditSpeciesMutation()
|
||||||
const { isError, isFetching, data } = useGetSpeciesDetailsQuery(id!, { skip: isNew })
|
const { isError, isFetching, data } = useGetSpeciesDetailsQuery(id!, { skip: isNew })
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteSpeciesMutation()
|
const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteSpeciesMutation()
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export const TimeBoundDetails = () => {
|
|||||||
})
|
})
|
||||||
const [editTimeBoundRequest] = useEditTimeBoundMutation()
|
const [editTimeBoundRequest] = useEditTimeBoundMutation()
|
||||||
|
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteTimeBoundMutation()
|
const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteTimeBoundMutation()
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const TimeUnitDetails = () => {
|
|||||||
const { isLoading, isError, isFetching, data } = useGetTimeUnitDetailsQuery(encodeURIComponent(id!), { skip: isNew })
|
const { isLoading, isError, isFetching, data } = useGetTimeUnitDetailsQuery(encodeURIComponent(id!), { skip: isNew })
|
||||||
const [editTimeUnitRequest] = useEditTimeUnitMutation()
|
const [editTimeUnitRequest] = useEditTimeUnitMutation()
|
||||||
|
|
||||||
const notify = useNotify()
|
const { notify } = useNotify()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteTimeUnitMutation()
|
const [deleteMutation, { isSuccess: deleteSuccess, isError: deleteError }] = useDeleteTimeUnitMutation()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user