Skip to content

Commit

Permalink
chore(apps/web): Define return type inline
Browse files Browse the repository at this point in the history
  • Loading branch information
nevendyulgerov committed Jan 2, 2025
1 parent b30afa7 commit ce06b07
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions apps/web/src/hooks/useUrlSearchParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ export const limitBounds = {

export type LimitBound = (typeof limitBounds)[keyof typeof limitBounds];

export type UsePaginationReturn = [
{ limit: LimitBound; page: number; query: string },
(page: number, limit: LimitBound, query: string) => void,
];

export const useUrlSearchParams = (): UsePaginationReturn => {
export const useUrlSearchParams = () => {
const searchParams = useSearchParams();
const router = useRouter();
const pathName = usePathname();
Expand All @@ -41,8 +36,13 @@ export const useUrlSearchParams = (): UsePaginationReturn => {
[router, pathName],
);

return useMemo(
const value: [
{ page: number; limit: LimitBound; query: string },
(page: number, limit: LimitBound, query: string) => void,
] = useMemo(
() => [{ page, limit, query }, updateParams],
[page, limit, query, updateParams],
);

return value;
};

0 comments on commit ce06b07

Please sign in to comment.