feat: add realtime with socket.io

This commit is contained in:
Divlo
2022-01-13 18:21:45 +01:00
parent 5c03a9b944
commit 9229131c1a
14 changed files with 1707 additions and 1528 deletions

View File

@ -9,7 +9,7 @@ const errorObject: ErrorObject = {
schemaPath: '/path'
}
describe('Authentication/getErrorTranslationKey', () => {
describe('hooks/useForm/getErrorTranslationKey', () => {
it('returns `errors:invalid` with unknown keyword', async () => {
expect(
getErrorTranslationKey({

View File

@ -15,11 +15,14 @@ export interface UsePaginationOptions {
inverse?: boolean
}
export type SetItems<T> = React.Dispatch<React.SetStateAction<T[]>>
export interface UsePaginationResult<T> {
items: T[]
nextPage: NextPage
resetPagination: () => void
hasMore: boolean
setItems: SetItems<T>
}
export const usePagination = <T extends { id: number }>(
@ -81,5 +84,5 @@ export const usePagination = <T extends { id: number }>(
setItems([])
}, [])
return { items, hasMore, nextPage, resetPagination }
return { items, hasMore, nextPage, resetPagination, setItems }
}